我试图从多个数组中删除一个值,而不必发出多个 Mongo 命令。我的语法一定不正确,任何帮助将不胜感激。
当我尝试:
update = BCON_NEW("$pull",
"{",
"files.$.like", BCON_UTF8 (account_id),
"}",
"{",
"files.$.hate", BCON_UTF8 (account_id),
"}",
"{",
"files.$.love", BCON_UTF8 (account_id),
"}",
"{",
"files.$.funny", BCON_UTF8 (account_id),
"}",
"{",
"files.$.sad", BCON_UTF8 (account_id),
"}",
"{",
"files.$.anger", BCON_UTF8 (account_id),
"}",
"{",
"files.$.kiss", BCON_UTF8 (account_id),
"}"
);
如果我将其简化为以下内容,它将失败:
update = BCON_NEW("$pull",
"{",
"files.$.like", BCON_UTF8 (account_id),
"}"
);