MongoDB.live, free & fully virtual. June 9th - 10th. Register Now

Does MongoDB support sessions across multiple pages?

Does MongoDB support sessions like the way PHP does? I want to have stored values the can be used across multiple pages.

Welcome to the community @kev_stev!

MongoDB’s client sessions (and the associated MongoDB\Driver\Session class in the PHP driver) provide context for a single client connection and are a different concept from the application sessions you are thinking of. These logical sessions are used to enable MongoDB features like retryable writes and transactions, and cannot be shared between multiple clients or threads. You also cannot write custom data to a MongoDB session; these are for internal resource tracking.

If you want to share data between pages in your PHP application, you would continue to use PHP sessions.

Regards,
Stennie