We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
From this example: https://docs.mongodb.com/manual/tutorial/geospatial-tutorial/#prerequisites
It would be nice if db-migrate could support this: db.restaurants.createIndex({ location: "2dsphere" })
db.restaurants.createIndex({ location: "2dsphere" })
This currently can't be done with addIndex NoSQL API.
addIndex
Workaround: loading native mongodb driver:
const MongoClient = require('mongodb').MongoClient; const assert = require('assert'); const url = 'mongodb://mongo:27017/test'; exports.up = function(db, callback) { MongoClient.connect(url, function(err, dbnative) { assert.equal(null, err); assert.notEqual(null, dbnative); dbnative.collection('ubicaciones').createIndex({ location: "2dsphere" }) dbnative.close(); callback(); }); return null; } <bountysource-plugin> --- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/46557329-add-support-for-mongo-2dsphere-indexes?utm_campaign=plugin&utm_content=tracker%2F12293389&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F12293389&utm_medium=issues&utm_source=github). </bountysource-plugin>
The text was updated successfully, but these errors were encountered:
Another workaround
exports.up = async function (db) { const options = { run_on: new Date() }; const mongoDbNative = await db._run('getDbInstance', null, options); await mongoDbNative .collection(COLLECTION_NAME) .createIndex( { location: '2dsphere' }, { name: INDEX_NAME, background: true } ); await mongoDbNative.close(); };
Sorry, something went wrong.
No branches or pull requests
From this example:
https://docs.mongodb.com/manual/tutorial/geospatial-tutorial/#prerequisites
It would be nice if db-migrate could support this:
db.restaurants.createIndex({ location: "2dsphere" })
This currently can't be done with
addIndex
NoSQL API.Workaround: loading native mongodb driver:
The text was updated successfully, but these errors were encountered: