Search code examples
jquerynode.jsmongodbmongoosenode-webkit

Mongoose inserting \u0000


I'm having trouble inserting text in mongoDb from an html input in node-webkit.

I have this html bad boy here :

<input id="cats" type="text" class="form-control" />

I am using mongoose to save this :

function saveACat(){
   var fluffy = new Kitten({ name: $("#cats").val() });
   fluffy.save(function(err,fluffy){
       if (err) return console.error(err);
   });
}

When i enter Hello in the "cats" field the inserted data is : H\u0000e\u0000l\u0000l\u0000l\o0000

When i hardcode the text instead of taking it from "cats" field the insert work correctly.

Any idea ?


Solution

  • Like WiredPrairie said it seem to be a bug in node webkit v0.9.2 I simply reverted to v0.8.6 and its now working I can correctly insert non-hardcoded text in mongoDB.

    Here's the link that made me realise the problem stackoverflow.com/questions/23290362/