ni-c / heimcontrol.js

Home-Automation with node.js and Raspberry PI
MIT License
1.41k stars 297 forks source link

/api/login post request makes the node crash #83

Closed BadBauds closed 10 years ago

BadBauds commented 10 years ago

Doing a post request with good credentials in the body causes the node to crash with this error :

heimcontrol.js/node_modules/mongodb/lib/mongodb/connection/base.js:242 throw message;
^ Error: Cannot use a writeConcern without a provided callback

BadBauds commented 10 years ago

I found a basic fix. Simply pass a writeConcern value of 0 to the collection update call in heimcontrol.js/routes/index.js (line 515). Change u.update({email: r[0].email}, { $set: {'token': token}}); to u.update({email: r[0].email}, { $set: {'token': token}}, { w: 0 });

tjanson commented 10 years ago

Which version of MongoDB are you using? I’m guessing this is an issue introduced with 2.6’s changes. (Actually, maybe not. I’m just wondering why I haven’t encountered this.)

BadBauds commented 10 years ago

I'm using MongoDB 2.4.9.