使用allowExtendedOperators进行环回upsert

时间:2016-02-15 17:42:54

标签: javascript node.js mongodb loopbackjs

我正在尝试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吗?

0 个答案:

没有答案