@parameter1/graphql-type-objectid

1.0.21 • Public • Published

GraphQL ObjectID Type

A custom MongoDB ObjectID GraphQL scalar type.

Installation

yarn add @parameter1/graphql-type-objectid

Usage

Add the custom scalar to your resolvers and inject the ObjectId class from mongodb (or elsewhere, e.g. Mongoose).

// resolvers.js
const GraphQLObjectID = require('@parameter1/graphql-type-objectid');
const { ObjectId } = require('mongodb');

module.exports = {
  ObjectID: GraphQLObjectID(ObjectId),

  // your resovlers here...
};

And to your GraphQL type definitions.

scalar ObjectID

Readme

Keywords

none

Package Sidebar

Install

npm i @parameter1/graphql-type-objectid

Weekly Downloads

2

Version

1.0.21

License

MIT

Unpacked Size

3.6 kB

Total Files

5

Last publish

Collaborators

  • brandonbk
  • zarathustra323
  • solocommand