I have written a very simple script to print the count of some states of a worker script. However I cannot print error messages which I had queried and projected with find(). Here is the script:
conn = new Mongo();
db = conn.getDB("AABackend");
...
print("Error messages:");
print(db.jobs.find({"state":"failed"}, {error_message:1}));
It's the last line that doesn't work. I expect something like:
{ "_id" : ObjectId("55377e5293671115faf44b15"), "error_message" : "foobar" }
but I get
DBQuery: AABackend.jobs -> { "state" : "failed" }
I couldn't find something in the MongoDB documentation about this but just a hint would really help.