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

Poor error message for find using sort

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

      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 Unassigned
            Reporter:
            jarryDk Michael Bornholdt Nielsen [X]
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: