Is there any Mongo (command line) function so that I can turn a string into an object? like JSON.parse or something like that?
db.sessions.update ({}, {'$ set': {'extra': JSON.parse (stringData)}});
my decision:
function my_extra() { db.tempData.find().forEach( function(obj) { obj.extra = db.eval(obj.myString); db.tempData.save(obj); } ); }; my_extra();
However, I try this: db.tempData.update ({}, {'$ set': {'extra': db.eval (myString)}}); but this will not work .. saying that myString is undefined. so i use this.myString but not working. so I have to use this function.
Is there a way to refer to myString in the second parameter?
source share