I wonder what I am doing wrong.
I use Sailsv0.10 and mongo2.6.0 and want to update an array field (using $push) in a collection via native.
My model:
If you want to use native() you can always try the same query directly in your mongo-DB. Because _id is a Object-id you should
var ObjectId = require('mongodb').ObjectID;
User.native(function (err, collection) {
collection.update({_id: new ObjectId(anIdVariable)},{$push:{pubs:aPubsVariable}}, function (err) {
});
You can add the mongo-native-driver to you app with npm install mongodb --save