mongoose save problem

547 views
Skip to first unread message

Arindam

unread,
Sep 12, 2011, 3:27:49 AM9/12/11
to Mongoose Node.JS ORM
Hi,

When I try to save my document, it does not get saved, does not throw
any error and the callback is not called back.
Before save I am printing and it shows, as follows,
{ address: 'test',
price: 12312,
bhk: 2,
_id: 4e6db32ec03084d01f000001,
create_date: Mon, 12 Sep 2011 07:22:22 GMT,
location: { lng: 92.93757389999996, lat: 26.2006043 },
prop_type: 'Apartment' }

just after that I try to save it as

rent.save(function(err){
console.log("rent.save start");
if(err) {
throw err;
console.log("error in save");
}
console.log("saved");

});

But it does not work.

Any clue ?

Arindam.

Arindam

unread,
Sep 12, 2011, 3:42:19 AM9/12/11
to Mongoose Node.JS ORM
In one of the posts in stackoverflow (http://stackoverflow.com/
questions/5070750/mongoose-cygwin-and-mongodb-not-saving), they were
suggesting to run mongod from windows and not from cygwin, I have done
that. But inspite of that it is not working..

Arindam

unread,
Sep 12, 2011, 4:17:29 AM9/12/11
to Mongoose Node.JS ORM
finally found the problem..
in the schema, I had a field called "address", looks like this is a
reserved word in mongodb
When I changed the field name to prop_address, my data got saved in
the database...

If there is any list of reserved words in mongodb or mongoose, please
mention the list or location where it can be found.

Aaron Heckmann

unread,
Sep 22, 2011, 9:34:25 PM9/22/11
to mongoo...@googlegroups.com
address is not reserved. care to share the error?

--
http://mongoosejs.com
http://github.com/learnboost/mongoose
You received this message because you are subscribed to the Google
Groups "Mongoose Node.JS ORM" group.
To post to this group, send email to mongoo...@googlegroups.com
To unsubscribe from this group, send email to
mongoose-orm...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/mongoose-orm?hl=en



--
Aaron


Aaron Heckmann

unread,
Sep 22, 2011, 9:36:08 PM9/22/11
to mongoo...@googlegroups.com
btw:

rent.save(function(err){
   console.log("rent.save start");
   if(err) {
     throw err;
     console.log("error in save");  <<=== this code will not be reached
   }
--
Aaron


Reply all
Reply to author
Forward
0 new messages