Using map/reduce for mapping the properties in a collection
- by And
Update: follow-up to MongoDB Get names of all keys in collection.
As pointed out by Kristina, one can use Mongodb 's map/reduce to list the keys in a collection:
db.things.insert( { type : ['dog', 'cat'] } );
db.things.insert( { egg : ['cat'] } );
db.things.insert( { type : [] });
db.things.insert( { hello : [] } );
mr =…