Uploaded image for project: 'Java Driver'
  1. Java Driver
  2. JAVA-1197

DBCollection.createIndex/ensureIndex deprecation notice is flipped from MongoDB Manual documentation

    • Type: Icon: Improvement Improvement
    • Resolution: Done
    • Priority: Icon: Major - P3 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

            Assignee:
            Unassigned Unassigned
            Reporter:
            ceefour Hendy Irawan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: