Class | Mongoid::Cursor |
In: |
lib/mongoid/cursor.rb
|
Parent: | Object |
Mongoid wrapper of the Ruby Driver cursor.
OPERATIONS | = | [ :close, :closed?, :count, :explain, :fields, :full_collection_name, :hint, :limit, :order, :query_options_hash, :query_opts, :selector, :skip, :snapshot, :sort, :timeout | Operations on the Mongo::Cursor object that will not get overriden by the Mongoid::Cursor are defined here. |
collection | [R] | |
cursor | [R] | |
klass | [R] |
Create the new +Mongoid::Cursor+.
@example Instantiate the cursor.
Mongoid::Cursor.new(Person, cursor)
@param [ Class ] klass The class associated with the cursor. @param [ Collection ] collection The Mongoid::Collection instance. @param [ Mongo::Cursor ] cursor The Mongo::Cursor to be proxied.
Iterate over each document in the cursor and yield to it.
@example Iterate over the cursor.
cursor.each { |doc| p doc.title }