Details
-
Bug
-
Resolution: Done
-
Major - P3
-
None
-
2.4
-
Windows 7, MongoDB Java Driver v2.10.1, MongoDB v2.4.9
Description
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