库名:hongyan_imlog;
集合名:chat_201802_1;
数据:{ "_id" : ObjectId("5a977aa97f8b9a0684b2ff85"), "content" : { "content" : "没有" }, "dateTime" : NumberLong(1519574651) }需要对content里面的content做正则匹配或模糊查询:
show dbs;
use hongyan_imlog;
show collections;
db.chat_201802_1.find({"content.content":/没有/i});
db.chat_201802_1.find({
content:{
content:"没有"
}
}); // 这种形式不能正则,只能相等查询
//性能测试
db.chat_201802_1.find({"classname":"RC:TxtMsg","content.content":/没有/i}).sort({dateTime:1}).skip(1000).limit(100).explain("executionStats")