I wonder what I'm doing wrong.
I am using Sailsv0.10 and mongo2.6.0 and want to update the array field (using $ push) in the collection via native.
My model:
module.exports = {
schema: true,
attributes: {
username: {
type: 'string',
required: true
},
pubs: {
type: 'array',
defaultsTo: []
},
...
My function:
User.native(function (err, collection) {
collection.update({username:aUsernameVariable},{$push:{pubs:aPubsVariable}}, function (err) {
});
He is still working. But why does this not work as a request with an id field?
User.native(function (err, collection) {
collection.update({id:anIdVariable},{$push:{pubs:aPubsVariable}}, function (err) {
});
I definitely use the correct identifier for the request to validate it.
What am I doing wrong? Or is it an ObjectId type conversion problem for the Sails-Mongo adapter
source
share