• Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 2.4
    • Component/s: Query Operations
    • Environment:
      Windows 7, MongoDB Java Driver v2.10.1, MongoDB v2.4.9

      The following code

      Test.java
      MongoClient client = new MongoClient();
      		DB db = client.getDB("school");
      		DBCollection collection = db.getCollection("students");
      		BasicDBList list = new BasicDBList();
      		list.add(new BasicDBObject("$elemMatch",
      				new BasicDBObject("type", "homework")));
      		BasicDBObject query = new BasicDBObject("scores", new BasicDBObject(
      				"$all", list));
      		System.out.println(query);
      		DBObject cursor = collection.findOne(new BasicDBObject(), query);
      		System.out.println(cursor);
      

      returns exception com.mongodb.MongoException: Unsupported projection option: $all
      although if you run the command that is printed out in the shell it returns a result without error.

      Steps to reproduce:

      • import the attached file in MongoDB
      • run the code

            Assignee:
            trisha.gee@10gen.com Trisha Gee
            Reporter:
            jarasez Mihaela Hetea
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: