File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -173,6 +173,29 @@ notation.
173173 end
174174
175175
176+ Legacy ``$query`` Syntax
177+ ------------------------
178+
179+ *This usage is deprecated.*
180+
181+ The ``find`` method allows providing the query and the options using the
182+ legacy ``$query`` syntax in the first parameter:
183+
184+ .. code-block:: ruby
185+
186+ collection.find(:'$query' => {name: 'Mr. Smith'})
187+ # Equivalent to:
188+ collection.find(name: 'Mr. Smith')
189+
190+ collection.find(:'$query' => {name: 'Mr. Smith'}, :'$sort' => {age: 1})
191+ # Equivalent to:
192+ collection.find(name: 'Mr. Smith').sort(age: 1)
193+
194+ When the query is executed against MongoDB 3.2 or newer, the driver will
195+ use the protocol appropriate for the server version in question, automatically
196+ converting the query as needed to either a find command or an OP_MSG payload.
197+
198+
176199.. _query-options:
177200
178201Query Options
You can’t perform that action at this time.
0 commit comments