Skip to content

Commit 41191a6

Browse files
committed
edits
1 parent 26210c4 commit 41191a6

File tree

2 files changed

+30
-19
lines changed

2 files changed

+30
-19
lines changed

source/includes/read/retrieve.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,9 @@
3333
# end-cursor
3434

3535

36-
# Finds and prints up to 5 documents with a "number_of_employees" value of 1000
36+
# Finds and prints up to 2 documents with a "number_of_employees" value of 1000
3737
# start-modify
38-
limit_results = collection.find({ 'number_of_employees' => 1000 }).limit(5)
38+
limit_results = collection.find({ 'number_of_employees' => 1000 }).limit(2)
3939

4040
limit_results.each do |doc|
4141
puts doc

source/read/retrieve.txt

Lines changed: 28 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -96,17 +96,15 @@ The following code calls the ``each`` method to iterate over the query results:
9696
.. output::
9797
:visible: false
9898

99-
{"_id":{"$oid":"..."},"name":"Mitsubishi Motors","permalink":"mitsubishi-motors",
100-
"crunchbase_url":"http:\/\/www.crunchbase.com\/company\/mitsubishi-motors",
101-
... }
102-
103-
{"_id":{"$oid":"..."},"name":"Western Digital","permalink":"western-digital",
104-
"crunchbase_url":"http:\/\/www.crunchbase.com\/company\/western-digital",
105-
... }
106-
107-
{"_id":{"$oid":"..."},"name":"Celarayn","permalink":"celarayn","crunchbase_url":
108-
"http:\/\/www.crunchbase.com\/company\/celarayn",
109-
... }
99+
{"_id"=>BSON::ObjectId('...'), "name"=>"Mitsubishi Motors", "permalink"=>"mitsubishi-motors",
100+
"crunchbase_url"=>"http://www.crunchbase.com/company/mitsubishi-motors",
101+
"homepage_url"=>"http://www.mitsubishi-motors.com", ...}
102+
{"_id"=>BSON::ObjectId('...'), "name"=>"Western Digital", "permalink"=>"western-digital",
103+
"crunchbase_url"=>"http://www.crunchbase.com/company/western-digital",
104+
"homepage_url"=>"http://www.wdc.com/en", ...}
105+
{"_id"=>BSON::ObjectId('...'), "name"=>"Celarayn", "permalink"=>"celarayn",
106+
"crunchbase_url"=>"http://www.crunchbase.com/company/celarayn",
107+
"homepage_url"=>"http://www.celarayn.es", ...}
110108

111109
.. note:: Find All Documents
112110

@@ -197,13 +195,26 @@ results. The following table describes some of these options:
197195

198196
The following example uses the ``find`` method to find all documents in which
199197
the ``number_of_employees`` field has the value ``1000``. The example uses the
200-
``limit`` option to return a maximum of ``5`` results:
198+
``limit`` option to return a maximum of ``2`` results:
201199

202-
.. literalinclude:: /includes/read/retrieve.rb
203-
:language: ruby
204-
:emphasize-lines: 3
205-
:start-after: start-modify
206-
:end-before: end-modify
200+
.. io-code-block::
201+
:copyable:
202+
203+
.. input:: /includes/read/retrieve.rb
204+
:start-after: start-modify
205+
:end-before: end-modify
206+
:language: ruby
207+
:dedent:
208+
209+
.. output::
210+
:visible: false
211+
212+
{"_id"=>BSON::ObjectId('...'), "name"=>"Akamai Technologies", "permalink"=>"akamai-technologies",
213+
"crunchbase_url"=>"http://www.crunchbase.com/company/akamai-technologies",
214+
"homepage_url"=>"http://www.akamai.com", ...}
215+
{"_id"=>BSON::ObjectId('...'), "name"=>"Yodle", "permalink"=>"yodle",
216+
"crunchbase_url"=>"http://www.crunchbase.com/company/yodle",
217+
"homepage_url"=>"http://www.yodle.com", ...}
207218

208219
For a full list of options, see the API documentation for the
209220
`find <{+api-root}/Mongo/Collection.html#find-instance_method>`__

0 commit comments

Comments
 (0)