Minimongo Error on Serverside Meteor Script?

▼魔方 西西 提交于 2019-12-13 19:23:01

问题


I'd like to push elements to a mongo array, and I have this query which should would with the current version of meteor mongo (2.6.7).

This is the query:

Coll.upsert({},{ $push: {
                   'events': {
                       $each: [{'id': new Mongo.ObjectID, 'start':startDate, ... }],
                       $sort: {'start': 1}
                   }
           }});

...And here is the minimongo error... Printed to the server console!

I20151117-13:51:54.730(11)? Exception while invoking method 'addReservationTimeslot' MinimongoError: $sort requires $slice to be present
I20151117-13:51:54.731(11)?     at MinimongoError (packages/minimongo/packages/minimongo.js:52:1)
I20151117-13:51:54.732(11)?     at MODIFIERS.$push (packages/minimongo/packages/minimongo.js:3244:1)
I20151117-13:51:54.732(11)?     at packages/minimongo/packages/minimongo.js:3052:1
I20151117-13:51:54.732(11)?     at Function._.each._.forEach (packages/underscore/packages/underscore.js:142:1)
I20151117-13:51:54.732(11)?     at packages/minimongo/packages/minimongo.js:3027:1
I20151117-13:51:54.732(11)?     at Function._.each._.forEach (packages/underscore/packages/underscore.js:142:1)
I20151117-13:51:54.732(11)?     at Function.LocalCollection._modify (packages/minimongo/packages/minimongo.js:3020:1)
I20151117-13:51:54.732(11)?     at simulateUpsertWithInsertedId (packages/mongo/mongo_driver.js:670:1)
I20151117-13:51:54.732(11)?     at [object Object].MongoConnection._update (packages/mongo/mongo_driver.js:537:1)
I20151117-13:51:54.732(11)?     at [object Object].<anonymous> (packages/meteor/helpers.js:118:1)

I am probably missing something about the minimongo <-> mongo connection, but how could a server side method be possibly limited by the minimongo implementation?

来源:https://stackoverflow.com/questions/33748426/minimongo-error-on-serverside-meteor-script

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!