I'm trying to update a database in mongo using a string variable passed in. However, Javascript automatically coerces the variable type, and makes a "type" key in the database instead of what the string type points to is (let's say "notify" for instance)
"update_notifications": function (id ,type ,callback) {
db.collection("backend_users", function(err, collection) {
collection.update(
{"_id": new mongodb.ObjectID(id)},
{ $bit: { type : { xor: 1 } } },
function (err) {
if (err) { console.log(color.red(err)); }
callback(err);
}
);
});
},
Is there anyway to force mongo to use "notify" instead of creating a new "type" key? Thanks!