I am using the mongodb native driver for node. I call ensureIndex({ keywords: 1})
after retrieving the collection. When I check in the mongo console, nothing appears when I call db.mycol.getIndexes()
.
What am I doing wrong?
The API docs helped a little: http://mongodb.github.com/node-mongodb-native/api-generated/db.html#ensureindex
You're supposed to call ensureIndex on the database object, not the collection. This contradicts the JavaScript console.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With