Skip to content
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

Merged
merged 4 commits into from
Jan 29, 2025

Conversation

rustagir
Copy link
Contributor

@rustagir rustagir commented Jan 27, 2025

https://jira.mongodb.org/browse/DOCSP-45065

Adds documentation for HTTP Sessions

Staging

Checklist

  • Add tests and ensure they pass

@rustagir rustagir requested a review from a team as a code owner January 27, 2025 18:01
@rustagir rustagir requested a review from norareidy January 27, 2025 18:01
@github-actions github-actions bot added the docs label Jan 27, 2025
@rustagir rustagir requested a review from GromNaN January 27, 2025 18:05
Copy link
Contributor

@mongoKart mongoKart left a 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

docs/sessions.txt Outdated Show resolved Hide resolved
docs/sessions.txt Outdated Show resolved Hide resolved
docs/sessions.txt Outdated Show resolved Hide resolved
docs/sessions.txt Outdated Show resolved Hide resolved
Copy link
Member

@GromNaN GromNaN left a 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.

Comment on lines 85 to 90
.. code-block:: sh

db.sessions.createIndex(
{ "expiry_field": 1 },
{ expireAfterSeconds: 0 }
)
Copy link
Member

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);
});

@rustagir rustagir merged commit 867731c into mongodb:5.x Jan 29, 2025
44 checks passed
.. code-block:: php

Schema::create('sessions', function (Blueprint $collection) {
$collection->expire('expiry_field', 0);
Copy link
Member

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);

Copy link
Contributor Author

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants