Skip to content

Commit d55c206

Browse files
authored
make sure that collection is created in mongo
1 parent 4ac8bfd commit d55c206

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/PhpConsole/Storage/MongoDB.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ public function __construct($server = 'mongodb://localhost:27017', $db = 'phpcon
3030
throw new \Exception('Unable to get collection');
3131
}
3232

33+
if (!in_array($collection, $this->mongoCollection->db->getCollectionNames())) {
34+
$this->mongoCollection->db->createCollection($collection);
35+
}
36+
3337
$this->mongoCollection->ensureIndex(array(
3438
'expireAt' => 1,
3539
), array(

0 commit comments

Comments
 (0)