localDb> db.help.createIndex({fielda:“text”})
TypeError: db.help.createIndex is not a function
Getting this error in Mongosh
localDb> db.help.createIndex({fielda:“text”})
TypeError: db.help.createIndex is not a function
Getting this error in Mongosh
In the shell (and this is true both for the legacy mongo
as well as for mongosh
) the help
property of most objects is special as it is used for the integrated contextual help. If in mongosh
you do db.help
or db.help()
the shell prints out the help content for the database class.
To get around that, you can do:
db.getCollection('help').createIndex({fielda:"text"})
Thank you so much for the root cause …it was confusing when the command did not work ,
your solution worked …we have just started on Mongodb, will probably change the collection name.
Thanks again
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.