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?