コード例 #1
0
        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));
        }
コード例 #2
0
        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));
        }
コード例 #3
0
 internal MongoIndex(MongoIndexKeys key, MongoIndexOptions options)
 {
     Key     = key;
     Options = options;
 }