1 MongoVUE用法
1.1 模糊查询
头匹配:
{"title":new RegExp("^各地发起纪念周总理")}
任意位置匹配:
{"published":{$gte: "2013-05-01", $lt: "2013-06-10"}, "title":new RegExp(".*北京.*")}
1.2 时间段查询
{"published":{$gte: "2013-05-01", $lt: "2013-06-10"}}
1.3 联合查询
{"published":{$gte: "2013-05-01", $lt: "2013-06-10"}, "title":new RegExp("^北京")}
2 mongo.jar用法
2.1 联合查询
BasicDBObject query = new BasicDBObject();
query.put("published", new BasicDBObject("$gte", "2013-05-01").append("$lt", "2013-06-11"));
query.put("title", new BasicDBObject("$regex", ".*北京.*"));