Compound Index Mongodb

[Solved] Compound Index Mongodb | Perl - Code Explorer | yomemimo.com
Question : compound index mongodb

Answered by : weary-sloth

db.collectionName.createIndex({field:value, field:value})
The order of fields listed in a compound index has significance.
For instance, if a compound index consists of { userid: 1, score: -1 },
the index sorts first by userid and then, within each userid value, sorts by score.

Source : | Last Update : Sat, 09 Jan 21

Answers related to compound index mongodb

Code Explorer Popular Question For Perl