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

Function GetHiddenFlagFromOptions

pg_documentdb/src/commands/coll_mod.c:1067–1095  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1065
1066
1067static bool
1068GetHiddenFlagFromOptions(pgbson *indexOptions)
1069{
1070 if (indexOptions == NULL)
1071 {
1072 return false;
1073 }
1074
1075 bson_iter_t iter;
1076 PgbsonInitIterator(indexOptions, &iter);
1077 while (bson_iter_next(&iter))
1078 {
1079 const char *key = bson_iter_key(&iter);
1080 const bson_value_t *value = bson_iter_value(&iter);
1081 if (strcmp(key, "hidden") == 0)
1082 {
1083 if (value->value_type != BSON_TYPE_BOOL)
1084 {
1085 ereport(ERROR, (errcode(ERRCODE_DOCUMENTDB_TYPEMISMATCH),
1086 errmsg(
1087 "BSON field 'hidden' is the wrong type '%s', expected type 'bool'",
1088 BsonTypeName(value->value_type))));
1089 }
1090 return value->value.v_bool;
1091 }
1092 }
1093
1094 return false;
1095}
1096
1097
1098static void

Callers 1

Calls 2

PgbsonInitIteratorFunction · 0.85
BsonTypeNameFunction · 0.85

Tested by

no test coverage detected