@@ -69,7 +69,7 @@ class MongoDbSessionHandler implements \SessionHandlerInterface
69
69
*/
70
70
public function __construct ($ mongo , array $ options )
71
71
{
72
- if (!($ mongo instanceof \MongoClient || $ mongo instanceof \Mongo)) {
72
+ if (!($ mongo instanceof \MongoClient || $ mongo instanceof \Mongo || $ mongo instanceof \ MongoDB \Client )) {
73
73
throw new \InvalidArgumentException ('MongoClient or Mongo instance required ' );
74
74
}
75
75
@@ -108,7 +108,7 @@ public function close()
108
108
*/
109
109
public function destroy ($ sessionId )
110
110
{
111
- $ this ->getCollection ()->remove (array (
111
+ $ this ->getCollection ()->deleteOne (array (
112
112
$ this ->options ['id_field ' ] => $ sessionId ,
113
113
));
114
114
@@ -120,7 +120,7 @@ public function destroy($sessionId)
120
120
*/
121
121
public function gc ($ maxlifetime )
122
122
{
123
- $ this ->getCollection ()->remove (array (
123
+ $ this ->getCollection ()->deleteMany (array (
124
124
$ this ->options ['expiry_field ' ] => array ('$lt ' => new \MongoDate ()),
125
125
));
126
126
@@ -140,7 +140,7 @@ public function write($sessionId, $data)
140
140
$ this ->options ['expiry_field ' ] => $ expiry ,
141
141
);
142
142
143
- $ this ->getCollection ()->update (
143
+ $ this ->getCollection ()->updateOne (
144
144
array ($ this ->options ['id_field ' ] => $ sessionId ),
145
145
array ('$set ' => $ fields ),
146
146
array ('upsert ' => true , 'multiple ' => false )
0 commit comments