An open API service indexing awesome lists of open source software.

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

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).