Regression in DBCollection for retrieving Index information

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Done
    • Priority: Major - P3
    • None
    • Affects Version/s: 3.2.2
    • Component/s: None
    • None
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Most of the information is here: http://stackoverflow.com/questions/35659940/mongo-java-client-dbcollection-doesnt-return-whether-an-index-is-sparse-or-no

      But I'll also paste below..

      After recently upgrading the Java Mongo Driver from 2.6 to 3.2, I've noticed that I can no longer see if an index is sparse or not in DBCollection. On top of that, I don't think it's even creating sparse indexes.

      For example:

              DBCollection entityCollection = db.getCollection("testCollectionIndex2");
      
              DBObject newIndex = new BasicDBObject();
              newIndex.put("field1", -1);
              BasicDBObject options = new BasicDBObject("unique", true);
              options.append("sparse", true);
              options.append("name", "testIndex");
              entityCollection.createIndex(newIndex, options);
      

      Previously to upgrading, the following test has passed:

              entityCollection = db.getCollection("testCollectionIndex2");
              // index 0 is _id
              DBObject mongoIndex = entityCollection.getIndexInfo().get(1);
              Assert.assertEquals(Boolean.TRUE, mongoIndex.get("sparse"));
      

      However, now the `sparse` field doesn't exist on the Index nor the returned JSON, at least as far as I can see in the Java driver.

      How can I verify if an index is `sparse` now, using DBCollection?

      This test is running against a 2.6 embedded MongoDB.

      I'll note that I updated my test, and my test only, to use the newer classes (MongoCollection) to create and retrieve indexes, and it seems to work. So, I have to assume that this is a regression in the DBCollection classes.

            Assignee:
            Unassigned
            Reporter:
            Brandon Vulaj [X]
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: