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.

-- 
You received this message because you are subscribed to the Google Groups 
"mongoose-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to mongoose-users+unsubscr...@googlegroups.com.
To post to this group, send email to mongoose-users@googlegroups.com.
Visit this group at http://groups.google.com/group/mongoose-users.
For more options, visit https://groups.google.com/d/optout.

Reply via email to