Skip to content

Commit d5dfbc2

Browse files
author
Emily Giurleo
authored
RUBY-2413 Do not cache query results from system collections (#2106)
1 parent 7334484 commit d5dfbc2

File tree

1 file changed

+12
-13
lines changed

1 file changed

+12
-13
lines changed

source/tutorials/query-cache.txt

Lines changed: 12 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -215,20 +215,19 @@ System Collections
215215
==================
216216

217217
MongoDB stores system information in collections that use the ``database.system.*``
218-
namespace pattern.
218+
namespace pattern. These are called system collections.
219219

220-
When the query cache is enabled, it will cache all system collection results.
221-
However, system collections are not subject to the same cache invalidation rules
222-
as normal collections; if your app relies on up-to-date information from
223-
system collections, please ensure that you are performing queries against the
224-
system collections with the query cache disabled, as demonstrated below.
220+
Data in system collections can change due to activity not triggered by the
221+
application (such as internal server processes) and as a result of a variety of
222+
database commands issued by the application. Because of the difficulty of
223+
determining when the cached results for system collections should be expired,
224+
queries on system collections bypass the query cache.
225225

226-
.. code-block:: ruby
226+
You may read more about system collections in the
227+
:manual:`MongoDB documentation </reference/system-collections/>`.
227228

228-
Mongo::QueryCache.uncached do
229-
Mongo::Client.new([ '127.0.0.1:27017' ], database: 'admin') do |client|
230-
users = client['system.users'].find.to_a
231-
#=> Does not return cached results
232-
end
233-
end
229+
.. note ::
230+
231+
Even when the query cache is enabled, query results from system collections
232+
will not be cached.
234233

0 commit comments

Comments
 (0)