您的位置:首页 > 博客中心 > 数据库 >

MongoDB常用功能

时间:2022-03-10 17:17

一、查询

var doc = new Document();

1、模糊查询
var reg = new MongoRegex(".*" + qry.名称 + ".*", MongoRegexOption.IgnoreCase);
doc["Name"] = reg;

2、IN查询
var docIn = new Document("$in", qry.名称.Split(‘,‘));
doc["Name"] = docIn;

3、等值查询
doc["Name"] = qry.名称;

4、介于时间值之间
Document docLessGreater = new Document();//参数
doc.Insert("$gte", startTime, 0);//大于开始时间
doc.Insert("$lte", endTime, 1);//小于结束时间
doc["CollectTime"] = docLessGreater;

MongoDB常用功能,布布扣,bubuko.com

热门排行

今日推荐

热门手游