我想将元素推送到一个mongo数组,我有这个查询应该使用当前版本的meteor mongo(2.6.7)。
这是查询:
Coll.upsert({},{ $push: {
'events': {
$each: [{'id': new Mongo.ObjectID, 'start':startDate, ... }],
$sort: {'start': 1}
}
}});
...这是 minimongo 错误...打印到服务器控制台!
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)
我可能遗漏了一些关于minimongo&lt; - &gt; mongo连接,但是服务器端方法怎么可能受到minimongo实现的限制呢?