初始条件:
如何检索所有在目的地列表中有三个城市的旅行者? 目前我只能计算一个旅行者的目的地总数......
BasicDBObject query = new BasicDBObject("destinations", new BasicDBObject("$exists", true));
query.put("country.$id", countryId);
query.put("$where","this.destinations.length <= " + maxNumDestinations);
DB db = getMongoDbFactory().getDb();
DBCollection travellerCollection = db.getCollection("traveller");
DBCursor cursor = travellerCollection.find(query);
return cursor;