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,theC
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:{imageUr
3.
Card.update({_id: updateInfo._id}, {note0:updateInfo.note0, note1: updateInfo.note1},{multi:true}
None of these three worked!!! Please help..
 
댓글 없음:
댓글 쓰기