ruby - mongo get first data after sorting by descending -


how first data on mongo after sorting data desc. example :

i'm using tutorial in app : mongo ruby

i'm typing in console :

client = mongo::client.new db     = client['example-db'] coll   = db['example-collection'] collect_data = coll.sort("desc created") 

result collect_data.count = 11

how first data collect_data ?

need help, master

try

collect_data[0] 

or

collect_data.to_a[0] 

Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -