Use GraphQL Mesh with Mongoose to simplify your schema creation.
This handler allows you to use the GraphQL schema created by graphql-compose-mongoose.
To get started, install the handler library:
npm install @omnigraph/mongoose
yarn add @omnigraph/mongoose
pnpm add @omnigraph/mongoose
bun add @omnigraph/mongoose
Then, you can use it in your Mesh configuration:
mesh.config.ts
import { defineConfig } from '@graphql-mesh/compose-cli'import loadMongooseSubgraph from '@omnigraph/mongoose'import { User } from './models.ts'export const composeConfig = defineConfig({ subgraphs: [ { sourceHandler: loadMongooseSubgraph('MyMongooseApi', { connectionString: 'mongodb://localhost:27017/test', models: { // You can provide your models here User } }) } ]})
This site uses cookies for analytics and improving your experience.