I am getting this error from createIndex. My code looks like the following -
client.createIndex( {filename: true}, { writeConcern:{ w: 0 }});
I’m not sure what’s wrong. I am running NodeJS 14.17 and Mongo 4.1.0 npm.
Any advice is welcome.
Welcome to the MongoDB Community Forums @Animesh_Badjatya !
The validation message you provided originates from your MongoDB server deployment. Per the error message, the boolean true is not valid for an index key:value pattern.
Your filename:true should be filename:1 for an ascending index or filename:0 for a descending index.
Regards,
Stennie
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.