Skip to content

CaptorAB/graphql-objectid-scalar

Repository files navigation

CircleCI npm version install size

graphql-objectid-scalar

Usage

Install it with

npm install graphql-objectid-scalar

This package exports a mongodb GraphQLObjectId scalar :

import { GraphQLObjectId } from "graphql-objectid-scalar";

SDL with GraphQL-tools

When using the SDL with GraphQL-tools, define GraphQLObjectId as the resolver for the appropriate scalar type in your schema:

import { makeExecutableSchema } from "graphql-tools";
import { GraphQLObjectId } from "graphql-objectid-scalar";

const typeDefs = `
scalar GraphQLObjectId

type MyType {
  _id: GraphQLObjectId
}

# ...
`;

const resolvers = {
    GraphQLObjectId: GraphQLObjectId
};

export default makeExecutableSchema({ typeDefs, resolvers });

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published