MCPcopy Create free account
hub / github.com/documentdb/documentdb / CollectionHasStatisticsEnabled

Function CollectionHasStatisticsEnabled

pg_documentdb/src/metadata/index.c:2932–2955  ·  view source on GitHub ↗

* Checks if a collection has extended stats enabled. We do this by checking the index option * for the primary key index in the index catalog. */

Source from the content-addressed store, hash-verified

2930 * for the primary key index in the index catalog.
2931 */
2932bool
2933CollectionHasStatisticsEnabled(uint64 collectionId)
2934{
2935 /* Find the _id index (the primary key index for the collection) */
2936 IndexDetails *details = IndexNameGetIndexDetails(collectionId, "_id_");
2937 if (details == NULL)
2938 {
2939 return false;
2940 }
2941
2942 pgbson *indexOptions = details->indexSpec.indexOptions;
2943 if (indexOptions == NULL)
2944 {
2945 return false;
2946 }
2947
2948 bson_iter_t iter;
2949 if (!PgbsonInitIteratorAtPath(indexOptions, "statsEnabled", &iter))
2950 {
2951 return false;
2952 }
2953
2954 return bson_iter_as_bool(&iter);
2955}
2956
2957
2958static void

Calls 2

IndexNameGetIndexDetailsFunction · 0.85
PgbsonInitIteratorAtPathFunction · 0.85

Tested by

no test coverage detected