First I created the mongoose schema: 

var cardSchema = mongoose.Schema({
  **userId: String,
  imageUrl: String**})

Then I defined model:

var Card = mongoose.model('Card', cardSchema)

Then I created a new card:

var newCard = new Card({
   **userId: "bablaba"**});

Then the new card is saved correctly(I tested):

newCard.save(function(err,theCard){
  if(err) return console.log(err);
  console.log("saved");
  console.log(theCard);
  })

Now I need to update information in the card. I want to *add/insert* imageUrl 
into the saved new card. Here's a few ways I tried: 

1.

Card.where({ _id: _id }).update({
   $set: {imageUrl:"blablab"}
 });

2.

Card.update(_id,{$set:{imageUrl:"balbalab"}})

3.

Card.update({_id: updateInfo._id}, {note0:updateInfo.note0, note1: 
updateInfo.note1},{multi:true}, function(err, numberAffected){});

None of these three worked!!! Please help..

-- 
Job board: http://jobs.nodejs.org/
New group rules: 
https://gist.github.com/othiym23/9886289#file-moderation-policy-md
Old group rules: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
--- 
You received this message because you are subscribed to the Google Groups 
"nodejs" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/nodejs/2e0f5ed9-b5b5-4ba8-b4ef-1e3bb948296b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to