-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DOCSP-45065: sessions documentation #3254
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
straight 🔥
lgtm w/ a couple suggestions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM once the index creation snippet is more adapted to Laravel.
docs/sessions.txt
Outdated
.. code-block:: sh | ||
|
||
db.sessions.createIndex( | ||
{ "expiry_field": 1 }, | ||
{ expireAfterSeconds: 0 } | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Laravel way to create this index is to use the Schema builder.
Schema::create('sessions', function (Blueprint $collection) {
$collection->expire('expiry_field', 0);
});
.. code-block:: php | ||
|
||
Schema::create('sessions', function (Blueprint $collection) { | ||
$collection->expire('expiry_field', 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should use the actual field name, not the name of the option that contains the field name.
Since people would not customize the field names, this will prevent them from creating a useless index without noticing.
$collection->expire('expires_at', 0);
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Got it! as i understand, this is the name of the field that is stored in the session documents?
https://jira.mongodb.org/browse/DOCSP-45065
Adds documentation for HTTP Sessions
Staging
Checklist