https://github.com/matteodem/join-mongo
Transform any GraphQL query into MongoDB field specifiers
https://github.com/matteodem/join-mongo
graphql meteor mongodb
Last synced: about 2 months ago
JSON representation
Transform any GraphQL query into MongoDB field specifiers
- Host: GitHub
- URL: https://github.com/matteodem/join-mongo
- Owner: matteodem
- Created: 2018-02-20T18:18:55.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-02-20T18:23:40.000Z (over 7 years ago)
- Last Synced: 2025-03-29T16:34:26.535Z (3 months ago)
- Topics: graphql, meteor, mongodb
- Language: JavaScript
- Size: 1.95 KB
- Stars: 7
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Join Mongo
[Tiny](https://github.com/matteodem/join-mongo/blob/master/src/lib.js) package to transform your GraphQL query into MongoDB field specifiers.
```js
import { mongoDbCollection } from '...'
import transformAstToFieldSpecifiers from 'join-mongo'export const myAwesomeResolver = (root, args, context, ast) => {
return mongoDbCollection.find({}, {
fields: transformAstToFieldSpecifiers(ast),
})
}
```> Heavily inspired by [join-monster](https://www.npmjs.com/package/join-monster) and
dependent on [graphql-list-fields](https://www.npmjs.com/package/graphql-list-fields).