Indexes on collections may be created via ensure action:
for example:
creates one index that will be constructed in background : ensure(index("foo" -> Order.Ascending) background true)
creates one compound index that is sparse :
ensure(index("foo" -> Order.Descending, "doo" -> Order.Ascending) sparse true)
All attributes that can be specified can be found in http://docs.mongodb.org/manual/reference/method/db.collection.ensureIndex/#db.collection.ensureIndex.
Operations:
Total for specification CollectionEnsureIndexSpec | |
---|---|
Finished in | 5 seconds, 582 ms |
Results | 2 examples, 0 failure, 0 error |