Poor error message for find using sort

XMLWordPrintableJSON

    • Type: Improvement
    • Resolution: Done
    • Priority: Minor - P4
    • None
    • Affects Version/s: 2.11.3
    • Component/s: Error Handling
    • None
    • Environment:
      Windows 7
    • None
    • None
    • None
    • None
    • None
    • None
    • None

      Performing a search in which data must be sorted and you insert "" as key you get a poor error message.

      --------------------------------------------------------------------
      MongoClient mongo = new MongoClient(new ServerAddress(host, port),
      credentialList);
      DB mongodb = mongo.getDB(DB_NAME)
      DBCollection table = mongodb.getCollection(TABLE_NAME);
      DBCursor cursor = table.find();
      BasicDBObject orderBy = new BasicDBObject() ;
      orderBy.put("", 1);
      cursor.sort(orderBy);

      --------------------------------------------------------------------
      com.mongodb.MongoException: assertion d:\slave\windows_64bit_v2.4\mongo\src\mongo\db\../bson/bsonobjbuilder.h:92
      at com.mongodb.MongoException.parse(MongoException.java:82)
      at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:292)
      at com.mongodb.DBApiLayer$MyCollection.__find(DBApiLayer.java:273)
      at com.mongodb.DBCursor._check(DBCursor.java:368)
      at com.mongodb.DBCursor._hasNext(DBCursor.java:459)
      at com.mongodb.DBCursor.hasNext(DBCursor.java:484)

            Assignee:
            Unassigned
            Reporter:
            Michael Bornholdt Nielsen [X]
            None
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: