-
-
Save Marak/505164 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var item = { "hdbarcode": hdbarcode, "description": description }; | |
// 2nd argument is callback | |
getDescription(item.hdbarcode, function(upcDescrip){ | |
db.save(null, item, function (err, meta) { | |
// This does not change item on line 1. Why? | |
item.key = meta.key; | |
sys.puts('saved ' + JSON.stringify(item) + ' as '+ meta.key); | |
// tell client | |
res.simpleJSON(200, { "key": item.key, "message": "Success!" }); | |
// key is undefined, because item.key was never set | |
}); | |
}); | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment