Pawan
Pawan

Reputation: 32331

what does the value 1 Indicate in Mongo DB Collection Field Index?

I am using Mongo DB for our Application .

To OPtimize the Application first , we started initailly on Indexing Mongo DB COllections .

I have seen a example in net shown below as how to do a Indexing On a collection

db.products.ensureIndex( { "category": 1, "item": 1 } )

Please let me know what does the value 1 Indicate here ?? Is that standard ??

Upvotes: 0

Views: 66

Answers (1)

Srivatsa N
Srivatsa N

Reputation: 2321

It represents the order of the keys in the index. 1 for an ascending order and -1 for a descending. More details in http://docs.mongodb.org/manual/core/indexes/

Upvotes: 2

Related Questions