MongoDB\Model\IndexInfo::isSparse()
On this page
Definition
MongoDB\Model\IndexInfo::isSparse()
Return whether the index is a sparse index. This correlates with the
sparse
option forMongoDB\Collection::createIndex()
.function isSparse(): boolean
Return Values
A boolean indicating whether the index is a sparse index.
Examples
$info = new IndexInfo([ 'sparse' => true, ]); var_dump($info->isSparse());
The output would then resemble:
bool(true)
See Also
listIndexes command reference in the MongoDB manual
Sparse Indexes in the MongoDB manual