Using the code below I want to find the value in the field seq for the row where _id=user:
DbModels.prototype.autoIncrement = function(_collection, callback){
this.getCollection(_collection, function(error, seq_collection) {
if( error ) callback(error)
else {
console.log(seq_collection);
seq_collection.find({_id: 'Users'}, {'seq': 1}, function(error, result) {
if( error ) callback(error)
else {callback(null, result)}
});
}
});
}
DbModels.prototype.addUser = function(Users, callback) {
this.autoIncrement("seq", function(error, result){
if(error) callback(error);
else console.log("RESULT: "+result);ID=result;
});
The code is working properly, however the results is "RESULT: [object Object]" and I have no idea how I can convert [object Object] to a value in nodejs.
When I run the query in the mongo shell the output is: {"_id":"Users","seq":51}
Anyone any suggestions?