File tree Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Expand file tree Collapse file tree 3 files changed +20
-4
lines changed Original file line number Diff line number Diff line change @@ -2,7 +2,8 @@ name = "ruby-driver"
2
2
title = " Ruby MongoDB Driver"
3
3
toc_landing_pages = [
4
4
" /get-started" ,
5
- " /connect"
5
+ " /connect" ,
6
+ " /indexes"
6
7
]
7
8
8
9
intersphinx = [" https://www.mongodb.com/docs/manual/objects.inv" ]
Original file line number Diff line number Diff line change 8
8
9
9
# Create a new client and connect to the server
10
10
client = Mongo ::Client . new ( uri , options )
11
+
12
+ # start-sample-data
11
13
database = client . use ( 'sample_mflix' )
12
14
collection = database [ :movies ]
15
+ # end-sample-data
13
16
14
17
# start-index-single
15
18
# Create an index on the "title" field
26
29
puts doc . to_json
27
30
else
28
31
puts "No document found"
29
- end
32
+ end
30
33
# end-index-single-query
31
34
32
35
# start-check-single-index
Original file line number Diff line number Diff line change @@ -44,7 +44,19 @@ Sample Data
44
44
45
45
The examples in this guide use the ``movies`` collection in the
46
46
``sample_mflix`` database from the :atlas:`Atlas sample datasets
47
- </sample-data>`. To learn how to create a free MongoDB Atlas cluster and
47
+ </sample-data>`. To access this collection from your {+language+}
48
+ application, create a ``Mongo::Client`` object that connects to
49
+ an Atlas cluster and assign the following values to your ``database``
50
+ and ``collection``
51
+ variables:
52
+
53
+ .. literalinclude:: /includes/indexes/single-field.rb
54
+ :start-after: start-sample-data
55
+ :end-before: end-sample-data
56
+ :language: ruby
57
+ :copyable:
58
+
59
+ To learn how to create a free MongoDB Atlas cluster and
48
60
load the sample datasets, see the :atlas:`Get Started with Atlas
49
61
</getting-started>` guide.
50
62
@@ -118,6 +130,6 @@ API Documentation
118
130
To learn more about any of the methods discussed in this guide, see the
119
131
following API documentation:
120
132
121
- - `Collection#indexes<{+api-root+}/Mongo/Collection.html#indexes-instance_method>`__
133
+ - `Collection#indexes <{+api-root+}/Mongo/Collection.html#indexes-instance_method>`__
122
134
- `Index::View#create_one <{+api-root+}/Mongo/Index/View.html>`__
123
135
- `Collection#find <{+api-root+}/Mongo/Collection.html#find-instance_method>`__
You can’t perform that action at this time.
0 commit comments