Sunday, 9 April 2017

Mongoose compound index creation fields order

I have a question regarding compound index creation in mongodb: Say I want to create this compound index:

cSchema.index({account:1, authorization: 1, c_type: 1});

Problem is, javascript doesn't guarantee dictionary order, so I won't be sure the compound index is in the order I want.

How can I make sure it's indeed {account:1, authorization:1, c_type:1} in that order ?

Thanks !



via Harel Rozental

No comments:

Post a Comment