MongoDB ObjectId scalar type for GraphQL.js.
## Installation
$ npm i graphql-type-object-id-no-deps
Or
$ yarn add graphql-type-object-id-no-deps
Import the type:
import GraphQLObjectId from 'graphql-type-object-id-no-deps';
Or
import { GraphQLObjectId } from 'graphql-type-object-id-no-deps';
You can use this in a programmatically-constructed schema as with any other scalar type:
import { makeExecutableSchema } from '@graphql-tools/schema';
import GraphQLObjectId from 'graphql-type-object-id-no-deps';
const typeDefs = `
scalar ObjectId
# ...
`;
const resolvers = {
ObjectId: GraphQLObjectId,
};
export default makeExecutableSchema({ typeDefs, resolvers });
MIT