Print document value in mongodb shell
问题 I want to print the value for this JSON document in the mongo shell. Like a simple console output, without creating a new collection or document. Thanks in advance 回答1: I found a solution, by using .forEach() to apply a JavaScript method: db.widget.find( { id : "4" }, {quality_level: 1, _id:0} ).forEach(function(x) { print(x.quality_level); }); 回答2: db.collection.find() returns a cursor . There are a bunch of methods for the cursor object which can be used to get the cursor information,