I want to select all the columns of a document through "Map Reduce", but not able to understand how to write map function in this case.In short I want to do something like select * in SQL
Asked
Active
Viewed 193 times
-1
-
@Manuel Don't troll, just vote to close if you think this is a "bad" question however, I personally think you may have misread the question if you think it is that simple and "bad". – Sammaye Jul 26 '13 at 18:11
-
Sometimes I'm not sure to vote for a close. He must have tried something, otherwise he wouldnt know that he didnt understand "how to write map function". He should show us what he tried, so we can help. – Manuel Jul 26 '13 at 18:15
-
@Manuel Ok, well that line is normally used for a specific kind of trolling on this site, that's why I said that but if it is not then I take back what I said – Sammaye Jul 26 '13 at 18:56
3 Answers
1
You probably want .find()
. Example collection of users
, db.users.find()
would return everything.
Here's a nice list of SQL to MongoDB NoSQL commmands: http://docs.mongodb.org/manual/reference/sql-comparison/

tymeJV
- 103,943
- 14
- 161
- 157
-
Thanks tymeJV, but my question was related to "Map Reduce", I found a solution myself. we can use emit(this._id,this) in the map function. – Phalguni Jul 27 '13 at 04:20
1
If you want to select all the attributes you should probably emit this
.
emit(key, this);
in your map function.

juanmaia
- 56
- 3
0
You could take the this
object, which represents your document in the map function, but it might be polluted by other properties, better to strip out the properties you need manually.

Sammaye
- 43,242
- 7
- 104
- 146