Navigation
This version of the documentation is archived and no longer supported.

cursor.map()

cursor.map(function)
Parameters:
  • function – function to apply to each document visited by the cursor.

Apply function to each document visited by the cursor, and collect the return values from successive application into an array. Consider the following example:

db.users.find().map( function(u) { return u.name; } );

See also

cursor.forEach() for similar functionality.