Answers for "compound index mongodb"

0

compound index mongodb

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.
Posted by: Guest on January-02-2021
-1

mongodb index

db.collection.createIndex( { name: -1 } )
Posted by: Guest on October-19-2020

Browse Popular Code Answers by Language