Skip to content

Commit 09c864f

Browse files
committed
feat: exclude system collection in getAllCollection
1 parent 8b89b07 commit 09c864f

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

src/Schema/Builder.php

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,14 @@ protected function getAllCollections()
265265
{
266266
$collections = [];
267267
foreach ($this->connection->getMongoDB()->listCollections() as $collection) {
268-
$collections[] = $collection->getName();
268+
$name = $collection->getName();
269+
270+
// Skip system collections
271+
if (str_starts_with($name, 'system.')) {
272+
continue;
273+
}
274+
275+
$collections[] = $name;
269276
}
270277

271278
return $collections;

0 commit comments

Comments
 (0)