Skip to content

Instantly share code, notes, and snippets.

@tygas
Created September 17, 2014 11:25
Show Gist options
  • Save tygas/dd1f36e77d952074ccb3 to your computer and use it in GitHub Desktop.
Save tygas/dd1f36e77d952074ccb3 to your computer and use it in GitHub Desktop.
Mongo select deeper column
var cursor = db.VirtualMachine.find().limit(10);//
var map = function() {
emit(this._id, this.Name);
};
var emit = function(key, value) {
print("id: " + key + " Name: " + tojson(value));
};
while (cursor.hasNext()) {
var doc = cursor.next();
map.apply(doc);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment