For AI agents: a documentation index is available at https://www.mongodb.com/docs/llms.txt — markdown versions of all pages are available by appending .md to any URL path.

MongoDB\Model\CollectionInfo::isView()

New in version 2.2.

MongoDB\Model\CollectionInfo::isView()

Return whether the collection is a view.

function isView(): boolean

A boolean indicating whether the collection is a view.

<?php $db = (new MongoDB\Client)->test; $db->createCollection( 'myView', ['viewOn' => 'restaurants'],); foreach ($db->listCollections(['filter' => ['name' => 'myView']]) as $info) { var_dump($info->isView());}

The output resembles the following:

bool(true)