{ "name" : John, "contactInformation" : { email : “john@gmail.com”, phone: "12341621" } } |
We can query for the e.g. email field which is a nested field as follows with the Java API:
BasicDBObject searchCriteria = new BasicDBObject(); searchCriteria.put("contactInformation.email", emailToSearchFor); DBObject result = collection.findOne(searchCriteria); |
No comments:
Post a Comment