Method: Mongo::Cursor#to_a

Defined in:
lib/mongo/cursor.rb

#to_aArray

Receive all the documents from this cursor as an array of hashes.

Notes:

If you’ve already started iterating over the cursor, the array returned by this method contains only the remaining documents. See Cursor#rewind! if you need to reset the cursor.

Use of this method is discouraged - in most cases, it’s much more efficient to retrieve documents as you need them by iterating over the cursor.

Returns:

  • (Array)

    an array of documents.



247
248
249
# File 'lib/mongo/cursor.rb', line 247

def to_a
  super
end