Articles → MONGODB → Compound Index In Mongodb

Compound Index In Mongodb






Definition





Syntax


db.collection.createIndex(
    {
        field1: 1,
        field2: -1
    }
);



Example


Picture showing creating a compound index in mongodb



Posted By  -  Karan Gupta
 
Posted On  -  Thursday, April 25, 2024

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250