arrays - Node.JS, MongoDB TypeError: undefined function -
i have error on function call don't know why doesn't works.
.get(function(req, res) { appointment.find({'creator._id':'55836c3929294c2506000001'}).toarray(function(err, appoint){ console.log("retrieved records:"); console.log(appointment); }); });
here can find error alert :
typeerror: undefined not function @ object.handle (/users/maximesauvage/appoint/server.js:199:67)
(it's find method on row 199)
i want "appointment" rows creator._id = 55836c3929294c2506000001
my appointment json structure (an example):
{ "_id": { "$oid": "55846bd717ed43180f000002" }, "creator": { "_id": { "$oid": "55836c3929294c2506000001" }, "username": "hello", "email": "hello@toto.com", "__v": 2
.get(function(req, res) { appointment.find({'creator._id':'55836c3929294c2506000001'}, function(err, appoint){ console.log("retrieved records:"); var appointment = $.map(appoint, function(arr) { return arr; }); console.log(appoint); }); });
.toarray jquery function , can used on jquery objects. try above code.
Comments
Post a Comment