Docs Menu
Docs Home
/ / /
PHP Library Manual
/ / /

MongoDB\Model\IndexInfo::isSparse()

On this page

  • Definition
  • Return Values
  • Examples
  • See Also
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)

Back

isGeoHaystack()

Next

isText()