Implements the PubSubEngine interface from graphql-subscriptions using mongoose as the underlying pub/sub mechanism. Version 1.0.18 is the latest stable release. Allows multiple subscription manager instances to communicate via a shared mongoose database by publishing and subscribing to topics through mongoose. Designed for Apollo GraphQL subscriptions in Node.js environments that already use mongoose as a database driver. Key differentiator: enables cross-instance subscription events without external message brokers or Redis, suitable for serverless or multi-process setups where all instances share a mongoose backend.
npm install graphql-mongoose-subscriptionsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows creating a MongoosePubSub instance and using it with Apollo GraphQL subscriptions (subscribe and publish).
Ensure mongoose.connect() or mongoose.createConnection() is called and resolved before new MongoosePubSub().
To receive local events, subscribe before publishing, or use a separate mechanism like EventEmitter.
Consider upgrading to Apollo Server 4's built-in subscription support or using `@apollo/subgraph` with `graphql-subscriptions@2`.
Use a consistent topic naming scheme and subscribe to each topic individually, or implement custom filtering with withFilter.
Run `npm install graphql-mongoose-subscriptions` and ensure import path is correct: `import { MongoosePubSub } from 'graphql-mongoose-subscriptions';`Use ES module import: `import { MongoosePubSub } from 'graphql-mongoose-subscriptions';`Verify you imported `MongoosePubSub` from 'graphql-mongoose-subscriptions' and not from 'graphql-subscriptions'.