MongoDB for .Net Core 正则查询

查询Message表中 不包含某些内容

 

var filter = Builders<Message>.Filter.Gte(item => item.SendTime, StatDate);
filter &= Builders<Message>.Filter.Lte(item => item.SendTime, EndDate);
filter &= Builders<Message>.Filter.Eq(item => item.GameId, (uint)Mconfig.GameId);
filter &= Builders<Message>.Filter.Not(Builders<Message>.Filter.Or(
Builders<Message>.Filter.Regex(item => item.Content, new BsonRegularExpression(new Regex("IGame.TeamClient:RequestJoinTeamFromChannel"))),
Builders<Message>.Filter.Regex(item => item.Content, new BsonRegularExpression(new Regex("ZC_movetoMirror"))),
Builders<Message>.Filter.Regex(item => item.Content, new BsonRegularExpression(new Regex("UIManager.MarryWindow:ShowWindow"))),
Builders<Message>.Filter.Regex(item => item.Content, new BsonRegularExpression(new Regex("ShowEntityTips")))
));

查询内容中含有message的信息
Builders<Message>.Filter.Regex(item => item.Content, new BsonRegularExpression(new Regex("message")));


 

posted @ 2019-08-15 14:41  hahaMan  阅读(385)  评论(0编辑  收藏  举报