Using mongoskin .
I am trying to do a simple update and I keep getting the error:
Error: the argument passed in must be a single String of 12 bytes or a string of 24 hexadecimal characters in hexadecimal format
Different code I tried:
var mongo = require('mongoskin'), store = mongo.db(MONGO_DB_ADDESS + ':' + MONGO_DB_PORT + '/' + MONGO_DB_NAME + '?auto_reconnect=false'); session._id = 4eb5444d39e153e60b000001; store.collection('sessions').updateById({_id : session._id}, {$set: status_obj}, {upsert : false, multi : false, safe : false}, function() { ... }); store.collection('sessions').updateById(session._id, {$set: status_obj} );
I even tried:
store.collection('sessions').update( {'_id': session._id}, {$set: {"status":'unavailable'}} );
Any help appreciated!
Thanks Fyi, I can do the update via mongo using cli just fine:
db.sessions.update( {'_id': ObjectId('4eb5444d39e153e60b000001')}, {$set: {"status":'unavailable'}} );
Paulm source share