-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cli: add native-query create subcommand to create native query configuration #105
cli: add native-query create subcommand to create native query configuration #105
Conversation
…mongodb-expression-parser
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Bson::Undefined => todo!(), | ||
Bson::MaxKey => todo!(), | ||
Bson::MinKey => todo!(), | ||
Bson::DbPointer(_) => todo!(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Curious why the other number types are still todo!
other then Double
? Aren't the other number types pretty easy to add here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, it very easy to add implementations for the other scalar types. It just hasn't made it to the top of my todo list.
…mongodb-expression-parser
This is work in progress. The new subcommand is hidden by a build-time feature flag,
native-query-subcommand
, so that the work that is done so far can be reviewed and merged.The new command accepts a name for a native query, an optional input collection, and a file containing an aggregation pipeline, and produces a native query configuration file that includes type declarations inferred from the pipeline.
Here is an example that uses the sample-mflix connector configuration in the repo. Create a file called
pipeline.json
containing this pipeline:Then run this command:
That should create
fixtures/hasura/sample_mflix/connector/native_queries/title_words.json
There are notes on what is and isn't done in https://linear.app/hasura/project/mongodb-automatic-native-queries-fceb7aed3196/overview. Here is a copy of those notes:
These CLI commands will let users create native queries without having to write type declarations themselves. The CLI infers the parameter list, and return document type. We will want a type annotation syntax for arguments, but it may be possible to infer parameter types in some cases.
Here is what's done:
$documents
$match
$sort
$limit
$skip
$group
$replaceWith
$unwind
"$tomatoes.viewer.rating"
$split