Be able to create Search indexes from Mongo shell
Right now it seems like I can query indexes from the mongo shell but not create them, unless I am missing something in the docs?
This feature is now available for Atlas M10+ clusters running MongoDB 6.0.8 or later. See July 10, 2023 changelog and documentation to learn more.
-
Catalin commented
Could someone clear me up as to why this is a TIER-related implementation? The feature is available via web interface, via cloud api etc. but nodejs driver... needs M10+? Why?
-
Stefano commented
I just tried this from a Node.js (18.17) small program, using the (per package.json) the mongodb driver v 6.0.0 (which must be the latest/greatest as I just got it via npm)
against my cluster running on Mongodb 6.0.9.
The code, after connecting etc, issues
"collection.createSearchIndex(index)"
but i get the error
"MongoServerError: command not found"
The documentation linked above shows that Node.js could be used this way.
What gives?
ThanksPS: I do have readWrite access to the target db on which I'd like to create the index
-
sahit commented
When attempting to create a search index using mongosh, I encountered the following error:
MongoServerError: command not found
at Connection.onMessage
Similarly, when I tried to create the search index programmatically, I received the following error:
TypeError: Data.createSearchIndex is not a functioni am using a free tier cluster to test this
let me know if i am missing something
-
Morten commented
Or at least expose an API. Having to use puppeteer in the CI flow to create indexes feels so wrong when compared to how easy it is to automate everything else in Atlas and Realm