我的文件如下:
{
"_id": {
"$oid": "6257a55d04bf2167733f5b72"
},
"attributes": {
"CustomerName": "John",
"CustomerID": "28374",
"LoanID": "82349327409234"
},
"type": "Record"
}我的手表是这样的:
var watchCursor = db.transactions.watch([ {$match: {"attributes.LoanID": { $exists : true }}} ]);
while (!watchCursor.isExhausted()){
if (watchCursor.hasNext()){
print(JSON.stringify(watchCursor.next()));
}
}但是变更流找不到这个文档。有什么想法吗?请注意,我的搜索查询是在属性内的嵌套字段之后。
发布于 2022-04-19 05:01:20
啊,因为变更事件文件不是实际文件的确切副本。
在进行更新时,实际文档驻留在updateDescription.updatedFields中,如果插入,则驻留在fullDocument字段中。
参考文献:Mongodb更改-事件
https://stackoverflow.com/questions/71867286
复制相似问题