Thursday, June 11, 2015

Create an index in MongoDB

To create an index in MongoDB,

you can do the following:

> db.someCollection.createIndex({someIndexProperty: 1})
{
        "createdCollectionAutomatically" : false,
        "numIndexesBefore" : 1,
        "numIndexesAfter" : 2,
        "ok" : 1
}
>

Reference:
http://docs.mongodb.org/manual/tutorial/create-an-index/

No comments:

Post a Comment