diff --git a/db/jsobj.cpp b/db/jsobj.cpp index b8ad2b7b266..cdae3ffeed7 100644 --- a/db/jsobj.cpp +++ b/db/jsobj.cpp @@ -65,7 +65,10 @@ public: strcpy(codeCopy,code); func = JavaJS->functionCreate( code ); minilex.grabVariables(codeCopy, fields); - fullObject = fields.count("fullObject") > 0; + // if user references db, eg db.foo.save(obj), + // we make sure we have the whole thing. + fullObject = fields.count("fullObject") + + fields.count("db") > 0; nFields = fields.size(); } diff --git a/db/query.cpp b/db/query.cpp index b52f2a6ab59..07f06f0d565 100644 --- a/db/query.cpp +++ b/db/query.cpp @@ -404,6 +404,8 @@ bool dbEval(JSObj& cmd, JSObjBuilder& result) { Element args = cmd.findElement("args"); if( args.type() == Array ) { JSObj eo = args.embeddedObject(); + cout << "args:" << eo.toString() << endl; + cout << "code:\n" << code << endl; s.setObject("args", eo); }