-
Type: Improvement
-
Resolution: Done
-
Priority: Major - P3
-
None
-
Affects Version/s: 2.12.1
-
Component/s: API
-
Labels:None
MongoDB Manual recommends ensureIndex :
http://docs.mongodb.org/manual//tutorial/create-an-index/
http://docs.mongodb.org/manual//reference/method/db.collection.ensureIndex/
and deprecates createIndex since very long ago:
http://docs.mongodb.org/manual//reference/method/db.collection.createIndex/
db.collection.createIndex(keys, options)
Deprecated since version 1.8.
Creates indexes on collections.
Java API is the other way around, recommends createIndex:
http://api.mongodb.org/java/current/com/mongodb/DBCollection.html#createIndex(com.mongodb.DBObject) :
createIndex
public void createIndex(DBObject keys)
Calls createIndex(com.mongodb.DBObject, com.mongodb.DBObject) with default index options
and deprecates ensureIndex :
http://api.mongodb.org/java/current/com/mongodb/DBCollection.html#ensureIndex(com.mongodb.DBObject)
ensureIndex
@Deprecated
public void ensureIndex(DBObject keys)
Deprecated. use createIndex(DBObject) instead
Calls ensureIndex(com.mongodb.DBObject, com.mongodb.DBObject) with default options