Skip to content

Commit

Permalink
update for ndc-spec v0.2 (#139)
Browse files Browse the repository at this point in the history
Updates the MongoDB connector for ndc-spec v0.2 ([changelog link](https://github.com/hasura/ndc-spec/blob/9ce5e92e71ec3481e9d74741bd53dcdda3b6e81f/specification/src/specification/changelog.md#020))

The connector processes requests in two phases:
1. `ndc-query-plan` converts to an internal set of request types. In that process it denormalizes the request, annotates it with types, and constructs join plans. 
2. `mongodb-agent-common` consumes those internal types to produce mongodb query plans

This commit requires updates to both phases, including changes to the internal request types.

A number of unit tests still need to be updated according to the new mechanisms for handling relationships - specifically the change from root column references to named scopes. But we have integration tests for relationships which are passing which seems to indicate that things are generally working.
  • Loading branch information
hallettj authored Jan 22, 2025
1 parent 71c739c commit 687d1d0
Show file tree
Hide file tree
Showing 115 changed files with 4,965 additions and 4,158 deletions.
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,28 @@ This changelog documents the changes between release versions.

## [Unreleased]

### Changed

- **BREAKING:** Update to ndc-spec v0.2 ([#139](https://github.com/hasura/ndc-mongodb/pull/139))

#### ndc-spec v0.2

This database connector communicates with the GraphQL Engine using an IR
described by [ndc-spec](https://hasura.github.io/ndc-spec/). Version 0.2 makes
a number of improvements to the spec, and enables features that were previously
not possible. Highlights of those new features include:

- relationships can use a nested object field on the target side as a join key
- grouping result documents, and aggregating on groups of documents (pending implementation in the mongo connector)
- queries on fields of nested collections (document fields that are arrays of objects)
- filtering on scalar values inside array document fields - previously it was possible to filter on fields of objects inside arrays, but not on scalars

For more details on what has changed in the spec see [the
changelog](https://hasura.github.io/ndc-spec/specification/changelog.html#020).

Use of the new spec requires a version of GraphQL Engine that supports ndc-spec
v0.2, and there are required metadata changes.

## [1.6.0] - 2025-01-17

### Added
Expand Down
71 changes: 49 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 4 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,15 @@ resolver = "2"
# The tag or rev of ndc-models must match the locked tag or rev of the
# ndc-models dependency of ndc-sdk
[workspace.dependencies]
ndc-sdk = { git = "https://github.com/hasura/ndc-sdk-rs.git", tag = "v0.4.0" }
ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.1.6" }
ndc-sdk = { git = "https://github.com/hasura/ndc-sdk-rs.git", rev = "643b96b8ee4c8b372b44433167ce2ac4de193332" }
ndc-models = { git = "http://github.com/hasura/ndc-spec.git", tag = "v0.2.0-rc.2" }

indexmap = { version = "2", features = [
"serde",
] } # should match the version that ndc-models uses
itertools = "^0.12.1"
itertools = "^0.13.0"
mongodb = { version = "^3.1.0", features = ["tracing-unstable"] }
nonempty = "^0.11.0"
schemars = "^0.8.12"
serde = { version = "1", features = ["derive"] }
serde_json = { version = "1.0", features = ["preserve_order", "raw_value"] }
Expand Down
1 change: 1 addition & 0 deletions arion-compose/services/engine.nix
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ in
useHostStore = true;
command = [
"engine"
"--unstable-feature=enable-ndc-v02-support"
"--port=${port}"
"--metadata-path=${metadata}"
"--authn-config-path=${auth-config}"
Expand Down
2 changes: 1 addition & 1 deletion crates/cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ indexmap = { workspace = true }
itertools = { workspace = true }
ndc-models = { workspace = true }
nom = { version = "^7.1.3", optional = true }
nonempty = "^0.10.0"
nonempty = { workspace = true }
pretty = { version = "^0.12.3", features = ["termcolor"], optional = true }
ref-cast = { workspace = true }
regex = "^1.11.1"
Expand Down
Loading

0 comments on commit 687d1d0

Please sign in to comment.