b1f6c1c4 / Graphql Advanced Projection
Licence: mit
Fully customizable Mongoose/MongoDB projection generator.
Stars: β 46
Programming Languages
javascript
184084 projects - #8 most used programming language
Projects that are alternatives of or similar to Graphql Advanced Projection
Intro To Graphql
[Course] Introduction to GraphQL
Stars: β 175 (+280.43%)
Mutual labels: graphql, apollo-server, mongoose, mongodb
Next Graphql Blog
π A Blog including a server and a client. Server is built with Node, Express & a customized GraphQL-yoga server. Client is built with React, Next js & Apollo client.
Stars: β 152 (+230.43%)
Mutual labels: graphql, apollo, mongoose, mongodb
Boilerplate Vue Apollo Graphql Mongodb
Start your magical stack journey!
Stars: β 85 (+84.78%)
Mutual labels: graphql, apollo, mongoose, mongodb
Nest User Auth
A starter build for a back end which implements managing users with MongoDB, Mongoose, NestJS, Passport-JWT, and GraphQL.
Stars: β 145 (+215.22%)
Mutual labels: graphql, apollo-server, mongoose, mongodb
Apollo2 Subscriptions How To
Apollo Server 2 how to setup subscriptions
Stars: β 125 (+171.74%)
Mutual labels: graphql, apollo-server, mongoose, mongodb
Frisky
πΏ Open Source GraphQL API for Online Shows
Stars: β 161 (+250%)
Mutual labels: graphql, mongoose, mongodb
Sqldatasource
SQL DataSource for Apollo GraphQL projects
Stars: β 176 (+282.61%)
Mutual labels: graphql, apollo, apollo-server
Feathers Apollo
Feathers and Apollo Server Sample Project
Stars: β 176 (+282.61%)
Mutual labels: graphql, apollo-server, mongodb
Graphql Apq
π― Automatic persisted queries (APQ) for any GraphQL server.
Stars: β 43 (-6.52%)
Mutual labels: graphql, apollo, apollo-server
Awesome Apollo Graphql
A curated list of amazingly awesome things regarding Apollo GraphQL ecosystem π
Stars: β 126 (+173.91%)
Mutual labels: graphql, apollo, apollo-server
Graphql Modules
Enterprise Grade Tooling For Your GraphQL Server
Stars: β 962 (+1991.3%)
Mutual labels: graphql, apollo, apollo-server
Portara
Portara directive is a rate limiter / throttler for GraphQL
Stars: β 158 (+243.48%)
Mutual labels: graphql, apollo, apollo-server
Firestore Apollo Graphql
An example of a GraphQL setup with a Firebase Firestore backend. Uses Apollo Engine/Server 2.0 and deployed to Google App Engine.
Stars: β 371 (+706.52%)
Mutual labels: graphql, apollo, apollo-server
Nestjs Query
Easy CRUD for GraphQL.
Stars: β 325 (+606.52%)
Mutual labels: graphql, mongoose, mongodb
Example Storefront
Example Storefront is Reaction Commerceβs headless ecommerce storefront - Next.js, GraphQL, React. Built using Apollo Client and the commerce-focused React UI components provided in the Storefront Component Library (reactioncommerce/reaction-component-library). It connects with Reaction backend with the GraphQL API.
Stars: β 471 (+923.91%)
Mutual labels: graphql, apollo, mongodb
Express Graphql Mongodb Boilerplate
A boilerplate for Node.js apps / GraphQL-API / Authentication from scratch - express, graphql - (graphql compose), mongodb (mongoose).
Stars: β 288 (+526.09%)
Mutual labels: graphql, mongoose, mongodb
Graphql Nodejs Hapi Api
How to set-up a powerful API with Nodejs, GraphQL, MongoDB, Hapi, and Swagger
Stars: β 116 (+152.17%)
Mutual labels: graphql, mongoose, mongodb
Pup
The Ultimate Boilerplate for Products.
Stars: β 563 (+1123.91%)
Mutual labels: graphql, apollo, mongodb
Nest Angular
NestJS, Angular 6, Server Side Rendering (Angular Universal), GraphQL, JWT (JSON Web Tokens) and Facebook/Twitter/Google Authentication, Mongoose, MongoDB, Webpack, TypeScript
Stars: β 307 (+567.39%)
Mutual labels: graphql, mongoose, mongodb
graphql-advanced-projection
Fully customizable Mongoose/MongoDB projection generator.
Why
We already have graphql-projection, graphql-mongodb-projection, and graphql-db-projection.
But graphql-advanced-projection
is different from all of them above in the following ways:
-
Separete graphql schema and mongodb projection config. This helps you decouple schema and mongodb into two parts, each of them may change independently. Write graphql in
.graphql
, write config in javascript or.json
. -
Easy customization. No more
gqlField: { type: new GraphQLNonNull(GraphQLInt), projection: 'mongoField' }
. SimplygqlField: 'mongoField'
. -
We create resolvers.
gqlField: (parent) => parent.mongoField
can be automatically generated, even complicated ones likefirst: (parent) => parent.items.data[0].value
. -
Fully supports interfaces, fragments, and inline fragments. Write
typeProj: 'type'
andswitch (parent.type)
in__resolveType
.
Installation
$ yarn add graphql-advanced-projection
Usage
For a complete working demo, see the
examples
folder.
mongoose
Setup const UserSchema = new mongoose.Schema({
_id: String,
mongoA: String,
});
const User = mongoose.model('users', UserSchema);
graphql
Setup type Query {
user(id: ID!): User
}
type User {
userId: ID
field1: String
field2: String
}
graphql-advanced-projection
Setup const { project, resolvers } = gqlProjection({
User: {
proj: {
userId: '_id',
field1: 'mongoA',
field2: null,
},
},
});
Combine everything together
module.exports = makeExecutableSchema({
typeDefs,
resolvers: _.merge(resolvers, {
Query: {
async user(parent, args, context, info) {
const proj = project(info);
const result = await User.findById(args.id, proj);
return result.toObject();
},
},
User: {
field2: () => 'Hello World',
},
}),
resolverValidationOptions: { requireResolversForResolveType: false },
});
Run
query {
user(id: $id) {
field1
field2
}
}
proj = {
_id: 0,
mongoA: 1,
}
License
MIT
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].