This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { flow, map, get, add, reduce } from 'lodash/fp' | |
const getScore = get('score') | |
export const countUserScores = flow( | |
map(getScore), | |
reduce(add)(0), | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { crud, generateTypeDefsAndResolvers } from 'meteor/easy:graphqlizer' | |
import { AlienCollection } from '{...}' | |
const alienSchema = crud('Alien', AlienCollection) | |
const { typeDefs, resolvers } = generateTypeDefsAndResolvers({ | |
schemas: [alienSchema], | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Meteor } from 'meteor/meteor' | |
import transformAstToFieldSpecifiers from 'join-mongo' | |
const myAwesomeResolver = (args, context, root, ast) => { | |
return Meteor.users.createQuery({ | |
...transformAstToFieldSpecifiers(ast), | |
}).fetch() | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { crud, resolvers, resolver, typeDefs, typeDef, generateTypeDefsAndResolvers } from 'meteor/easy:graphqlizer' | |
import { AlienCollection, AlienSimpleSchema } from '{...}' | |
const alienSchema = { | |
typeDefs: [ | |
...typeDefs('Alien', AlienSimpleSchema), // Input and Type | |
// or cutom | |
typeDef.input('Alien', MyCustomAlienSchema), // only Input | |
` | |
type CustomType { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
... | |
"aggs": { | |
... | |
"label": { | |
"terms": { | |
"size": 10, | |
"shard_size": 0, | |
"script": "doc['labels.slug'].value" | |
}, |