diff --git a/CHANGELOG.md b/CHANGELOG.md index efd80fc1..cedb1b8d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,8 @@ This changelog documents the changes between release versions. ### Added +- Adds `_in` and `_nin` operators ([#122](https://github.com/hasura/ndc-mongodb/pull/122)) + ### Changed - **BREAKING:** If `configuration.json` cannot be parsed the connector will fail to start. This change also prohibits unknown keys in that file. These changes will help to prevent typos configuration being silently ignored. ([#115](https://github.com/hasura/ndc-mongodb/pull/115)) @@ -15,6 +17,26 @@ This changelog documents the changes between release versions. - Fixes for filtering by complex predicate that references variables, or field names that require escaping ([#111](https://github.com/hasura/ndc-mongodb/pull/111)) - Escape names if necessary instead of failing when joining relationship on field names with special characters ([#113](https://github.com/hasura/ndc-mongodb/pull/113)) +#### `_in` and `_nin` + +These operators compare document values for equality against a given set of +options. `_in` matches documents where one of the given values matches, `_nin` matches +documents where none of the given values matches. For example this query selects +movies that are rated either "G" or "TV-G": + +```graphql +query { + movies( + where: { rated: { _in: ["G", "TV-G"] } } + order_by: { id: Asc } + limit: 5 + ) { + title + rated + } +} +``` + ## [1.3.0] - 2024-10-01 ### Fixed diff --git a/crates/integration-tests/src/tests/filtering.rs b/crates/integration-tests/src/tests/filtering.rs index a2b4b743..310300ee 100644 --- a/crates/integration-tests/src/tests/filtering.rs +++ b/crates/integration-tests/src/tests/filtering.rs @@ -3,6 +3,29 @@ use ndc_test_helpers::{binop, field, query, query_request, target, variable}; use crate::{connector::Connector, graphql_query, run_connector_query}; +#[tokio::test] +async fn filters_using_in_operator() -> anyhow::Result<()> { + assert_yaml_snapshot!( + graphql_query( + r#" + query { + movies( + where: { rated: { _in: ["G", "TV-G"] } } + order_by: { id: Asc } + limit: 5 + ) { + title + rated + } + } + "# + ) + .run() + .await? + ); + Ok(()) +} + #[tokio::test] async fn filters_on_extended_json_using_string_comparison() -> anyhow::Result<()> { assert_yaml_snapshot!( diff --git a/crates/integration-tests/src/tests/snapshots/integration_tests__tests__filtering__filters_using_in_operator.snap b/crates/integration-tests/src/tests/snapshots/integration_tests__tests__filtering__filters_using_in_operator.snap new file mode 100644 index 00000000..6517e724 --- /dev/null +++ b/crates/integration-tests/src/tests/snapshots/integration_tests__tests__filtering__filters_using_in_operator.snap @@ -0,0 +1,17 @@ +--- +source: crates/integration-tests/src/tests/filtering.rs +expression: "graphql_query(r#\"\n query {\n movies(\n where: { rated: { _in: [\"G\", \"TV-G\"] } }\n order_by: { id: Asc }\n limit: 5\n ) {\n title\n rated\n }\n }\n \"#).run().await?" +--- +data: + movies: + - title: The Great Train Robbery + rated: TV-G + - title: A Corner in Wheat + rated: G + - title: From Hand to Mouth + rated: TV-G + - title: One Week + rated: TV-G + - title: The Devil to Pay! + rated: TV-G +errors: ~ diff --git a/crates/mongodb-agent-common/src/comparison_function.rs b/crates/mongodb-agent-common/src/comparison_function.rs index 34e01f99..842df44e 100644 --- a/crates/mongodb-agent-common/src/comparison_function.rs +++ b/crates/mongodb-agent-common/src/comparison_function.rs @@ -17,6 +17,7 @@ pub enum ComparisonFunction { NotEqual, In, + NotIn, Regex, /// case-insensitive regex @@ -36,6 +37,7 @@ impl ComparisonFunction { C::Equal => "_eq", C::NotEqual => "_neq", C::In => "_in", + C::NotIn => "_nin", C::Regex => "_regex", C::IRegex => "_iregex", } @@ -49,6 +51,7 @@ impl ComparisonFunction { C::GreaterThanOrEqual => "$gte", C::Equal => "$eq", C::In => "$in", + C::NotIn => "$nin", C::NotEqual => "$ne", C::Regex => "$regex", C::IRegex => "$regex", diff --git a/crates/mongodb-agent-common/src/scalar_types_capabilities.rs b/crates/mongodb-agent-common/src/scalar_types_capabilities.rs index c8942923..e0b12e87 100644 --- a/crates/mongodb-agent-common/src/scalar_types_capabilities.rs +++ b/crates/mongodb-agent-common/src/scalar_types_capabilities.rs @@ -112,15 +112,14 @@ fn bson_comparison_operators( bson_scalar_type: BsonScalarType, ) -> BTreeMap { comparison_operators(bson_scalar_type) - .map(|(comparison_fn, arg_type)| { + .map(|(comparison_fn, argument_type)| { let fn_name = comparison_fn.graphql_name().into(); match comparison_fn { ComparisonFunction::Equal => (fn_name, ComparisonOperatorDefinition::Equal), + ComparisonFunction::In => (fn_name, ComparisonOperatorDefinition::In), _ => ( fn_name, - ComparisonOperatorDefinition::Custom { - argument_type: bson_to_named_type(arg_type), - }, + ComparisonOperatorDefinition::Custom { argument_type }, ), } }) @@ -167,10 +166,27 @@ pub fn aggregate_functions( pub fn comparison_operators( scalar_type: BsonScalarType, -) -> impl Iterator { +) -> impl Iterator { iter_if( scalar_type.is_comparable(), - [(C::Equal, scalar_type), (C::NotEqual, scalar_type)].into_iter(), + [ + (C::Equal, bson_to_named_type(scalar_type)), + (C::NotEqual, bson_to_named_type(scalar_type)), + ( + C::In, + Type::Array { + element_type: Box::new(bson_to_named_type(scalar_type)), + }, + ), + ( + C::NotIn, + Type::Array { + element_type: Box::new(bson_to_named_type(scalar_type)), + }, + ), + (C::NotEqual, bson_to_named_type(scalar_type)), + ] + .into_iter(), ) .chain(iter_if( scalar_type.is_orderable(), @@ -181,11 +197,17 @@ pub fn comparison_operators( C::GreaterThanOrEqual, ] .into_iter() - .map(move |op| (op, scalar_type)), + .map(move |op| (op, bson_to_named_type(scalar_type))), )) .chain(match scalar_type { - S::String => Box::new([(C::Regex, S::String), (C::IRegex, S::String)].into_iter()), - _ => Box::new(std::iter::empty()) as Box>, + S::String => Box::new( + [ + (C::Regex, bson_to_named_type(S::String)), + (C::IRegex, bson_to_named_type(S::String)), + ] + .into_iter(), + ), + _ => Box::new(std::iter::empty()) as Box>, }) } diff --git a/fixtures/hasura/chinook/metadata/chinook.hml b/fixtures/hasura/chinook/metadata/chinook.hml index d988caff..d66b9dbc 100644 --- a/fixtures/hasura/chinook/metadata/chinook.hml +++ b/fixtures/hasura/chinook/metadata/chinook.hml @@ -21,11 +21,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: BinData + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: BinData Bool: representation: type: boolean @@ -37,11 +46,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: Bool + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Bool Date: representation: type: timestamp @@ -71,6 +89,8 @@ definition: argument_type: type: named name: Date + _in: + type: in _lt: type: custom argument_type: @@ -86,6 +106,13 @@ definition: argument_type: type: named name: Date + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Date DbPointer: aggregate_functions: count: @@ -95,11 +122,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: DbPointer + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: DbPointer Decimal: representation: type: bigdecimal @@ -137,6 +173,8 @@ definition: argument_type: type: named name: Decimal + _in: + type: in _lt: type: custom argument_type: @@ -152,6 +190,13 @@ definition: argument_type: type: named name: Decimal + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Decimal Double: representation: type: float64 @@ -189,6 +234,8 @@ definition: argument_type: type: named name: Double + _in: + type: in _lt: type: custom argument_type: @@ -204,6 +251,13 @@ definition: argument_type: type: named name: Double + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Double ExtendedJSON: representation: type: json @@ -241,6 +295,11 @@ definition: argument_type: type: named name: ExtendedJSON + _in: + type: custom + argument_type: + type: named + name: ExtendedJSON _iregex: type: custom argument_type: @@ -261,6 +320,11 @@ definition: argument_type: type: named name: ExtendedJSON + _nin: + type: custom + argument_type: + type: named + name: ExtendedJSON _regex: type: custom argument_type: @@ -303,6 +367,8 @@ definition: argument_type: type: named name: Int + _in: + type: in _lt: type: custom argument_type: @@ -318,6 +384,13 @@ definition: argument_type: type: named name: Int + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Int Javascript: aggregate_functions: count: @@ -369,6 +442,8 @@ definition: argument_type: type: named name: Long + _in: + type: in _lt: type: custom argument_type: @@ -384,6 +459,13 @@ definition: argument_type: type: named name: Long + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Long MaxKey: aggregate_functions: count: @@ -393,11 +475,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: MaxKey + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: MaxKey MinKey: aggregate_functions: count: @@ -407,11 +498,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: MinKey + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: MinKey "Null": aggregate_functions: count: @@ -421,11 +521,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: "Null" + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: "Null" ObjectId: representation: type: string @@ -437,11 +546,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: ObjectId + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: ObjectId Regex: aggregate_functions: count: @@ -478,6 +596,8 @@ definition: argument_type: type: named name: String + _in: + type: in _iregex: type: custom argument_type: @@ -498,6 +618,13 @@ definition: argument_type: type: named name: String + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: String _regex: type: custom argument_type: @@ -512,11 +639,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: Symbol + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Symbol Timestamp: aggregate_functions: count: @@ -544,6 +680,8 @@ definition: argument_type: type: named name: Timestamp + _in: + type: in _lt: type: custom argument_type: @@ -559,6 +697,13 @@ definition: argument_type: type: named name: Timestamp + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Timestamp Undefined: aggregate_functions: count: @@ -568,11 +713,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: Undefined + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Undefined object_types: Album: description: Object type for collection Album @@ -1146,7 +1300,7 @@ definition: type: named name: InsertArtist capabilities: - version: 0.1.5 + version: 0.1.6 capabilities: query: aggregates: {} diff --git a/fixtures/hasura/common/metadata/scalar-types/Date.hml b/fixtures/hasura/common/metadata/scalar-types/Date.hml index 6c8c0986..d94fa9d6 100644 --- a/fixtures/hasura/common/metadata/scalar-types/Date.hml +++ b/fixtures/hasura/common/metadata/scalar-types/Date.hml @@ -43,6 +43,10 @@ definition: argumentType: Date - name: _neq argumentType: Date + - name: _in + argumentType: "[Date!]!" + - name: _nin + argumentType: "[Date!]!" - name: _gt argumentType: Date - name: _gte @@ -57,6 +61,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt @@ -66,6 +72,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt @@ -75,6 +83,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt diff --git a/fixtures/hasura/common/metadata/scalar-types/Decimal.hml b/fixtures/hasura/common/metadata/scalar-types/Decimal.hml index 55211607..f41ef2a5 100644 --- a/fixtures/hasura/common/metadata/scalar-types/Decimal.hml +++ b/fixtures/hasura/common/metadata/scalar-types/Decimal.hml @@ -43,6 +43,10 @@ definition: argumentType: Decimal - name: _neq argumentType: Decimal + - name: _in + argumentType: "[Decimal!]!" + - name: _nin + argumentType: "[Decimal!]!" - name: _gt argumentType: Decimal - name: _gte @@ -57,6 +61,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt @@ -66,6 +72,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt @@ -75,6 +83,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt diff --git a/fixtures/hasura/common/metadata/scalar-types/Double.hml b/fixtures/hasura/common/metadata/scalar-types/Double.hml index e91ca3d4..a72f1887 100644 --- a/fixtures/hasura/common/metadata/scalar-types/Double.hml +++ b/fixtures/hasura/common/metadata/scalar-types/Double.hml @@ -35,6 +35,10 @@ definition: argumentType: Float - name: _neq argumentType: Float + - name: _in + argumentType: "[Float!]!" + - name: _nin + argumentType: "[Float!]!" - name: _gt argumentType: Float - name: _gte @@ -49,6 +53,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt @@ -58,6 +64,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt @@ -67,6 +75,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt diff --git a/fixtures/hasura/common/metadata/scalar-types/ExtendedJSON.hml b/fixtures/hasura/common/metadata/scalar-types/ExtendedJSON.hml index 5d6fae4c..915a0819 100644 --- a/fixtures/hasura/common/metadata/scalar-types/ExtendedJSON.hml +++ b/fixtures/hasura/common/metadata/scalar-types/ExtendedJSON.hml @@ -43,6 +43,10 @@ definition: argumentType: ExtendedJSON - name: _neq argumentType: ExtendedJSON + - name: _in + argumentType: "[ExtendedJSON!]!" + - name: _nin + argumentType: "[ExtendedJSON!]!" - name: _gt argumentType: ExtendedJSON - name: _gte @@ -61,6 +65,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt @@ -72,6 +78,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt @@ -83,6 +91,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt diff --git a/fixtures/hasura/common/metadata/scalar-types/Int.hml b/fixtures/hasura/common/metadata/scalar-types/Int.hml index f1098686..658fa3e8 100644 --- a/fixtures/hasura/common/metadata/scalar-types/Int.hml +++ b/fixtures/hasura/common/metadata/scalar-types/Int.hml @@ -35,6 +35,10 @@ definition: argumentType: Int - name: _neq argumentType: Int + - name: _in + argumentType: "[Int!]!" + - name: _nin + argumentType: "[Int!]!" - name: _gt argumentType: Int - name: _gte @@ -49,6 +53,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt @@ -58,6 +64,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt @@ -67,6 +75,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt diff --git a/fixtures/hasura/common/metadata/scalar-types/ObjectId.hml b/fixtures/hasura/common/metadata/scalar-types/ObjectId.hml index fbf46cad..3db6dd95 100644 --- a/fixtures/hasura/common/metadata/scalar-types/ObjectId.hml +++ b/fixtures/hasura/common/metadata/scalar-types/ObjectId.hml @@ -43,22 +43,32 @@ definition: argumentType: ObjectId - name: _neq argumentType: ObjectId + - name: _in + argumentType: "[ObjectId!]!" + - name: _nin + argumentType: "[ObjectId!]!" dataConnectorOperatorMapping: - dataConnectorName: chinook dataConnectorScalarType: ObjectId operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin - dataConnectorName: sample_mflix dataConnectorScalarType: ObjectId operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin - dataConnectorName: test_cases dataConnectorScalarType: ObjectId operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin logicalOperators: enable: true isNull: diff --git a/fixtures/hasura/common/metadata/scalar-types/String.hml b/fixtures/hasura/common/metadata/scalar-types/String.hml index 51efea15..12114802 100644 --- a/fixtures/hasura/common/metadata/scalar-types/String.hml +++ b/fixtures/hasura/common/metadata/scalar-types/String.hml @@ -35,6 +35,10 @@ definition: argumentType: String - name: _neq argumentType: String + - name: _in + argumentType: "[String!]!" + - name: _nin + argumentType: "[String!]!" - name: _gt argumentType: String - name: _gte @@ -53,6 +57,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt @@ -64,6 +70,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt @@ -75,6 +83,8 @@ definition: operatorMapping: _eq: _eq _neq: _neq + _in: _in + _nin: _nin _gt: _gt _gte: _gte _lt: _lt diff --git a/fixtures/hasura/sample_mflix/metadata/sample_mflix.hml b/fixtures/hasura/sample_mflix/metadata/sample_mflix.hml index 020cf95a..71bb110d 100644 --- a/fixtures/hasura/sample_mflix/metadata/sample_mflix.hml +++ b/fixtures/hasura/sample_mflix/metadata/sample_mflix.hml @@ -21,11 +21,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: BinData + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: BinData Bool: representation: type: boolean @@ -37,11 +46,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: Bool + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Bool Date: representation: type: timestamp @@ -71,6 +89,8 @@ definition: argument_type: type: named name: Date + _in: + type: in _lt: type: custom argument_type: @@ -86,6 +106,13 @@ definition: argument_type: type: named name: Date + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Date DbPointer: aggregate_functions: count: @@ -95,11 +122,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: DbPointer + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: DbPointer Decimal: representation: type: bigdecimal @@ -137,6 +173,8 @@ definition: argument_type: type: named name: Decimal + _in: + type: in _lt: type: custom argument_type: @@ -152,6 +190,13 @@ definition: argument_type: type: named name: Decimal + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Decimal Double: representation: type: float64 @@ -189,6 +234,8 @@ definition: argument_type: type: named name: Double + _in: + type: in _lt: type: custom argument_type: @@ -204,6 +251,13 @@ definition: argument_type: type: named name: Double + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Double ExtendedJSON: representation: type: json @@ -241,6 +295,11 @@ definition: argument_type: type: named name: ExtendedJSON + _in: + type: custom + argument_type: + type: named + name: ExtendedJSON _iregex: type: custom argument_type: @@ -261,6 +320,11 @@ definition: argument_type: type: named name: ExtendedJSON + _nin: + type: custom + argument_type: + type: named + name: ExtendedJSON _regex: type: custom argument_type: @@ -303,6 +367,8 @@ definition: argument_type: type: named name: Int + _in: + type: in _lt: type: custom argument_type: @@ -318,6 +384,13 @@ definition: argument_type: type: named name: Int + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Int Javascript: aggregate_functions: count: @@ -369,6 +442,8 @@ definition: argument_type: type: named name: Long + _in: + type: in _lt: type: custom argument_type: @@ -384,6 +459,13 @@ definition: argument_type: type: named name: Long + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Long MaxKey: aggregate_functions: count: @@ -393,11 +475,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: MaxKey + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: MaxKey MinKey: aggregate_functions: count: @@ -407,11 +498,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: MinKey + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: MinKey "Null": aggregate_functions: count: @@ -421,11 +521,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: "Null" + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: "Null" ObjectId: representation: type: string @@ -437,11 +546,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: ObjectId + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: ObjectId Regex: aggregate_functions: count: @@ -478,6 +596,8 @@ definition: argument_type: type: named name: String + _in: + type: in _iregex: type: custom argument_type: @@ -498,6 +618,13 @@ definition: argument_type: type: named name: String + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: String _regex: type: custom argument_type: @@ -512,11 +639,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: Symbol + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Symbol Timestamp: aggregate_functions: count: @@ -544,6 +680,8 @@ definition: argument_type: type: named name: Timestamp + _in: + type: in _lt: type: custom argument_type: @@ -559,6 +697,13 @@ definition: argument_type: type: named name: Timestamp + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Timestamp Undefined: aggregate_functions: count: @@ -568,11 +713,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: Undefined + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Undefined object_types: DocWithExtendedJsonValue: fields: @@ -1039,7 +1193,7 @@ definition: name: String procedures: [] capabilities: - version: 0.1.5 + version: 0.1.6 capabilities: query: aggregates: {} diff --git a/fixtures/hasura/test_cases/metadata/test_cases.hml b/fixtures/hasura/test_cases/metadata/test_cases.hml index 385ebb22..baf4c95d 100644 --- a/fixtures/hasura/test_cases/metadata/test_cases.hml +++ b/fixtures/hasura/test_cases/metadata/test_cases.hml @@ -21,11 +21,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: BinData + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: BinData Bool: representation: type: boolean @@ -37,11 +46,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: Bool + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Bool Date: representation: type: timestamp @@ -71,6 +89,8 @@ definition: argument_type: type: named name: Date + _in: + type: in _lt: type: custom argument_type: @@ -86,6 +106,13 @@ definition: argument_type: type: named name: Date + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Date DbPointer: aggregate_functions: count: @@ -95,11 +122,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: DbPointer + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: DbPointer Decimal: representation: type: bigdecimal @@ -137,6 +173,8 @@ definition: argument_type: type: named name: Decimal + _in: + type: in _lt: type: custom argument_type: @@ -152,6 +190,13 @@ definition: argument_type: type: named name: Decimal + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Decimal Double: representation: type: float64 @@ -189,6 +234,8 @@ definition: argument_type: type: named name: Double + _in: + type: in _lt: type: custom argument_type: @@ -204,6 +251,13 @@ definition: argument_type: type: named name: Double + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Double ExtendedJSON: representation: type: json @@ -266,6 +320,11 @@ definition: argument_type: type: named name: ExtendedJSON + _nin: + type: custom + argument_type: + type: named + name: ExtendedJSON _regex: type: custom argument_type: @@ -308,6 +367,8 @@ definition: argument_type: type: named name: Int + _in: + type: in _lt: type: custom argument_type: @@ -323,6 +384,13 @@ definition: argument_type: type: named name: Int + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Int Javascript: aggregate_functions: count: @@ -374,6 +442,8 @@ definition: argument_type: type: named name: Long + _in: + type: in _lt: type: custom argument_type: @@ -389,6 +459,13 @@ definition: argument_type: type: named name: Long + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Long MaxKey: aggregate_functions: count: @@ -398,11 +475,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: MaxKey + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: MaxKey MinKey: aggregate_functions: count: @@ -412,11 +498,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: MinKey + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: MinKey "Null": aggregate_functions: count: @@ -426,11 +521,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: "Null" + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: "Null" ObjectId: representation: type: string @@ -442,11 +546,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: ObjectId + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: ObjectId Regex: aggregate_functions: count: @@ -483,6 +596,8 @@ definition: argument_type: type: named name: String + _in: + type: in _iregex: type: custom argument_type: @@ -503,6 +618,13 @@ definition: argument_type: type: named name: String + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: String _regex: type: custom argument_type: @@ -517,11 +639,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: Symbol + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Symbol Timestamp: aggregate_functions: count: @@ -549,6 +680,8 @@ definition: argument_type: type: named name: Timestamp + _in: + type: in _lt: type: custom argument_type: @@ -564,6 +697,13 @@ definition: argument_type: type: named name: Timestamp + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Timestamp Undefined: aggregate_functions: count: @@ -573,11 +713,20 @@ definition: comparison_operators: _eq: type: equal + _in: + type: in _neq: type: custom argument_type: type: named name: Undefined + _nin: + type: custom + argument_type: + type: array + element_type: + type: named + name: Undefined object_types: nested_collection: fields: