https://github.com/ilgooz/service-graphql-fields-to-mongo-selections
Convert GraphQL fields to MongoDB selections
https://github.com/ilgooz/service-graphql-fields-to-mongo-selections
Last synced: about 2 months ago
JSON representation
Convert GraphQL fields to MongoDB selections
- Host: GitHub
- URL: https://github.com/ilgooz/service-graphql-fields-to-mongo-selections
- Owner: ilgooz
- Created: 2019-02-25T13:32:24.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-06-08T10:49:16.000Z (almost 5 years ago)
- Last Synced: 2025-01-31T13:22:24.280Z (4 months ago)
- Language: JavaScript
- Size: 6.84 KB
- Stars: 0
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
- awesome - GraphQL Fields to Mongo Selections - Convert GraphQL fields to MongoDB field selections (Data Manipulation)
README
# GraphQL Fields to MongoDB Selections
Convert GraphQL fields to MongoDB selections
# Contents
- [Installation](#Installation)
- [Definitions](#Definitions)
- [Tasks](#Tasks)
- [convert](#convert)# Installation
## MESG Core
This service requires [MESG Core](https://github.com/mesg-foundation/core) to be installed first.
You can install MESG Core by running the following command or [follow the installation guide](https://docs.mesg.com/guide/start-here/installation.html).
```bash
bash <(curl -fsSL https://mesg.com/install)
```## Service
Download the source code of this service, and then in the service's folder, run the following command:
```bash
mesg-core service deploy
```# Definitions
# Tasks
## convert
Task key: `convert`
Convert GraphQL fields to MongoDB selections
### Inputs
| **Name** | **Key** | **Type** | **Description** |
| --- | --- | --- | --- |
| **fields** | `fields` | `Object` | GraphQL fields. e.g.: '[ { name: 'a', fields: [ { name: 'b' } ] }, { name: 'c' } ]' |### Outputs
#### failure
Output key: `failure`
| **Name** | **Key** | **Type** | **Description** |
| --- | --- | --- | --- |
| **message** | `message` | `String` | |#### success
Output key: `success`
| **Name** | **Key** | **Type** | **Description** |
| --- | --- | --- | --- |
| **data** | `data` | `Object` | MongoDB selection format. e.g.: '{ a: { b: 1 }, c: 2 }' |