Skip to content

Instantly share code, notes, and snippets.

@shafferj
Created August 6, 2009 17:17
Show Gist options
  • Save shafferj/163449 to your computer and use it in GitHub Desktop.
Save shafferj/163449 to your computer and use it in GitHub Desktop.
>> cursor = User.collection.find({},{:fields=>nil, :offset=>0, :limit=>1, :sort=>{:$natural=>1}})
=> #<XGen::Mongo::Driver::Cursor:0x5f1838 @query=#<XGen::Mongo::Driver::Query:0x5f1888 @hint=nil, @order_by={:$natural=>1}, @number_to_return=1, @number_to_skip=0, @explain=nil, @selector={}, @fields=nil>, @collection=#<XGen::Mongo::Driver::Collection:0x7597c0 @name="users", @db=#<XGen::Mongo::Driver::DB:0x2511e5c @nodes=[["localhost", 27017]], @name="hotpotato_development", @strict=nil, @pk_factory=nil, @slave_ok=nil, @auto_reconnect=nil, @semaphore=#<Object:0x2511e34 @_mutex=#<Mutex:0x25119e8>>, @socket=#<TCPSocket:0x25119c0>, @port=27017, @host="localhost">, @hint=nil>, @db=#<XGen::Mongo::Driver::DB:0x2511e5c @nodes=[["localhost", 27017]], @name="hotpotato_development", @strict=nil, @pk_factory=nil, @slave_ok=nil, @auto_reconnect=nil, @semaphore=#<Object:0x2511e34 @_mutex=#<Mutex:0x25119e8>>, @socket=#<TCPSocket:0x25119c0>, @port=27017, @host="localhost">, @num_to_return=1, @cache=[], @closed=false, @can_call_to_a=true, @query_run=false, @rows=nil>
>> puts cursor.next_object.inspect
{"_id"=>#<XGen::Mongo::Driver::ObjectID:0x5959e8 @data=[243, 223, 122, 74, 3, 136, 131, 60, 222, 0, 0, 0]>, "created_at"=>2009-08-06 13:51:47 UTC, "updated_at"=>2009-08-06 13:51:47 UTC, "email"=>"blah"}
=> nil
>>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment