Hi All,
I am trying to figure out how to push array elements from my android app to a mongoose schema.
My schema looks like this:
var userSchema = mongoose.Schema({
var1 : String,
var2: String,
myArray: [String]
});
When I try to populate the array using:
user.findByIdAndUpdate(id,{$push: {myArray: {$each: [myArray]}}}, function (err, user) {
if (err) return handleError(err);
callback({'response':"Success"});
});
I get the following error:
user.findByIdAndUpdate(id,{$push: {myArray: {$each: [myArray]}}}, function (
^
ReferenceError: myArray is not defined
Is there anyone who could help with this?
Thanks a lot.