-
Type:
Improvement
-
Resolution: Unresolved
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
Suggestion by jmikola@mongodb.com https://github.com/mongodb/laravel-mongodb/pull/2909#discussion_r1579741403
Add an option to the cache configuration to use a database distinct from the database configured in database.php
Or parse the collection parameter to detect if there is a namespace.
Currently, it's already possible to use a distinct database for the cache, but this requires using a distinct connection.
// config/database.php return [ 'default' => 'mongodb', 'connections' => [ 'mongodb' => [ 'driver' => 'mongodb', 'dsn' => env('MONGODB_URI'), 'database' => 'application', ], 'mongodb-cache' => [ 'driver' => 'mongodb', 'dsn' => env('MONGODB_URI'), 'database' => 'cache', ], ];
// config/cache.php return [ 'default' => 'mongodb', 'stores' => [ 'mongodb' => [ 'driver' => 'mongodb', 'connection' => 'mongodb-cache', ], ], ];