我正在尝试upsert
我将$push
一个新元素放到一个数组的字段上。
但是,每当我使用$push
时,我都会收到错误消息,告诉我我不允许在运营商的开头使用$
。
这是调试跟踪:
loopback:connector:mongodb create +3s ThingUser { user: 'gerald', '$push': { things: 'hats' } }
loopback:connector:mongodb MongoDB: model=ThingUser command=insert +2ms [ { user: 'gerald', '$push': { things: 'hats' }, _id: undefined },
{ safe: true },
[Function] ]
loopback:connector:mongodb Error: +5ms { [MongoError: key $push must not start with '$']
name: 'MongoError',
message: 'key $push must not start with \'$\'' }
loopback:connector:mongodb create.callback +0ms ThingUser { [MongoError: key $push must not start with '$']
name: 'MongoError',
message: 'key $push must not start with \'$\'' } null
好像我没有把allowExtendedOperators
放在正确的位置。我已经尝试无处不在这件事情去了哪里?它不适用于upsert
吗?