UNPKG

graphql-compose-mongoose

Version:

Plugin for `graphql-compose` which derive a graphql types from a mongoose model.

14 lines (13 loc) 401 B
import { mongoose, Schema } from './mongooseCommon'; const PostSchema = new Schema({ _id: { type: Number }, title: { type: String, description: 'Post title' } // createdAt, created via option `timastamp: true` (see bottom) // updatedAt, created via option `timastamp: true` (see bottom) }); const PostModel = mongoose.model('Post', PostSchema); export { PostSchema, PostModel };