small medium large xlarge

01 Feb 2013, 14:44
Tim Holmes (2 posts)

(Mongodb chapter - in Version 2 of book)

Error is in final line of code, reads{ _id : phone._id }, phone, false);

should read

  db.phones.update({ _id : phone._id }, phone, false);

Took me ages to find out why the call wasn’t actually updating my collection, till I realised it was creating a new one called phone. Only found out when tried db.getCollectionNames()

BTW Not sure why update is used here and not save?

You must be logged in to comment