我有以下MongoDB更新...
DB.collection('counter').findOneAndUpdate(
{ _id: _id },
{ $inc: { 'events.598398c37a9e22304bb197fa.count': 1 } },
(e,d) => {
console.log(e);
})
这似乎有效,$ inc有效,但产生以下错误......
Error: key _events:598398c37a9e22304bb197fa.count must not contain '.'
at Error (native)
at serializeInto (/home/node_modules/bson/lib/bson/parser/serializer.js:731:19)
at serializeObject (/home/node_modules/bson/lib/bson/parser/serializer.js:294:18)
at serializeInto (/home/node_modules/bson/lib/bson/parser/serializer.js:754:17)
at serializeObject (/home/node_modules/bson/lib/bson/parser/serializer.js:294:18)
at serializeInto (/home/node_modules/bson/lib/bson/parser/serializer.js:754:17)
at serializeObject (/home/node_modules/bson/lib/bson/parser/serializer.js:294:18)
at serializeInto (/home/node_modules/bson/lib/bson/parser/serializer.js:596:17)
at serializeObject (/home/node_modules/bson/lib/bson/parser/serializer.js:294:18)
at serializeInto (/home/node_modules/bson/lib/bson/parser/serializer.js:754:17)
任何建议欢迎。