internal static MongoIndex DeserializeMongoIndex(JsonElement element) { Optional <MongoIndexKeys> key = default; Optional <MongoIndexOptions> options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } key = MongoIndexKeys.DeserializeMongoIndexKeys(property.Value); continue; } if (property.NameEquals("options")) { if (property.Value.ValueKind == JsonValueKind.Null) { property.ThrowNonNullablePropertyIsNull(); continue; } options = MongoIndexOptions.DeserializeMongoIndexOptions(property.Value); continue; } } return(new MongoIndex(key.Value, options.Value)); }
internal static MongoIndex DeserializeMongoIndex(JsonElement element) { Optional <MongoIndexKeys> key = default; Optional <MongoIndexOptions> options = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key")) { key = MongoIndexKeys.DeserializeMongoIndexKeys(property.Value); continue; } if (property.NameEquals("options")) { options = MongoIndexOptions.DeserializeMongoIndexOptions(property.Value); continue; } } return(new MongoIndex(key.Value, options.Value)); }
internal MongoIndex(MongoIndexKeys key, MongoIndexOptions options) { Key = key; Options = options; }