Skip to content

Commit 2faa2ac

Browse files
add information about adding an index to improve garbage collection performance
1 parent dde0ee1 commit 2faa2ac

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

cookbook/configuration/mongodb_session_storage.rst

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,13 @@ Setting Up the MongoDB Collection
159159
---------------------------------
160160

161161
Because MongoDB uses dynamic collection schemas, you do not need to do anything to initialize your
162-
session collection.
162+
session collection. However, you may want to add an index to improve garbage collection performance.
163+
From the `MongoDB shell`_:
163164

164-
.. _installed and configured a MongoDB server: http://docs.mongodb.org/manual/installation/
165+
.. code-block:: sql
166+
167+
use session_db
168+
db.session.ensureIndex( { "expireAt": 1 }, { expireAfterSeconds: 0 } )
169+
170+
.. _installed and configured a MongoDB server: http://docs.mongodb.org/manual/installation/
171+
.. _MongoDB shell: http://docs.mongodb.org/v2.2/tutorial/getting-started-with-the-mongo-shell/

0 commit comments

Comments
 (0)