c# mongo 2.0 驱动程序在 FindOneAndUpdateAsync 之后获取项目
c# mongo 2.0 driver get item after FindOneAndUpdateAsync
我在 c# 中有以下查询:
var filter = Builders<ME_UserInbox>.Filter.And(
Builders<ME_UserInbox>.Filter.Eq(n => n.UserId, userId),
Builders<ME_UserInbox>.Filter.ElemMatch(inbx => inbx.Inbox, msg => msg._id == msgId));
var update = Builders<ME_UserInbox>.Update.PullFilter(inbx => inbx.Inbox, msgs => msgs._id == msgId);
var upsert = new UpdateOptions()
{
IsUpsert = false
};
await collection.FindOneAndUpdateAsync(filter, update, upsert);
现在,如果我在最后一行之后写 .Result
。我是在更新之前还是之后获得文档?
TIA。
我在 c# 中有以下查询:
var filter = Builders<ME_UserInbox>.Filter.And(
Builders<ME_UserInbox>.Filter.Eq(n => n.UserId, userId),
Builders<ME_UserInbox>.Filter.ElemMatch(inbx => inbx.Inbox, msg => msg._id == msgId));
var update = Builders<ME_UserInbox>.Update.PullFilter(inbx => inbx.Inbox, msgs => msgs._id == msgId);
var upsert = new UpdateOptions()
{
IsUpsert = false
};
await collection.FindOneAndUpdateAsync(filter, update, upsert);
现在,如果我在最后一行之后写 .Result
。我是在更新之前还是之后获得文档?
TIA。