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

MongoDB\Model\IndexInfo::isSparse()

MongoDB\Model\IndexInfo::isSparse()

Return whether the index is a sparse index. This correlates with the sparse option for MongoDB\Collection::createIndex().

function isSparse(): boolean

A boolean indicating whether the index is a sparse index.

<?php
$info = new IndexInfo([
'sparse' => true,
]);
var_dump($info->isSparse());

The output would then resemble:

bool(true)