I have a list of ObjectId's mapped using Morphia. In java, the mapping looks like this:
public class Log {
@Indexed
public List<ObjectId> companyIds;
....
}
In Mongo shell, however, when I search using $elemMatch it will complain about invalid type.
> db.Log.find({ "companyIds" : { "$elemMatch" : ObjectId("5059e90d0364d02be740417a")}})
error: {
"$err" : "invalid parameter: expected an object ($elemMatch)",
"code" : 10065
}
Is there anything else I need to do to use $elemMatch with ObjectId's?
Thanks