An experimental library that bridges GraphQL queries to MongoDB collections using graphql-anywhere. Version 0.5.2 is the latest and only stable release. It allows querying MongoDB with GraphQL syntax, supporting projections, filtering (eq, gte, gt, etc.), pagination (limit/skip), sorting via @sort/@sortDesc directives, and multiple collections per query. Key differentiator: schemaless querying without defining a GraphQL schema upfront. However, it is explicitly marked as not production-ready and has no recent updates since 2017. Use with caution for prototyping only.
npm install graphql-anywhere-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Connects to MongoDB, executes a GraphQL query on the 'users' collection with limit and filter, then prints results.
Consider using an alternative like graphql-compose-mongoose or PostGraphile for production.
Use import graphql from 'graphql-anywhere-mongodb' and then call graphql.forUri().
Always use await: const mongo = await graphql.forUri(...).
Use ES modules and import syntax. If you need CJS, stick to v0.4.x or transpile.
Be aware that _id is always included in results; filter if needed.
Replace import { forUri } from 'graphql-anywhere-mongodb' with import graphql from 'graphql-anywhere-mongodb'.Use await: const mongo = await graphql.forUri(...).
Install the peer dependency: npm install graphql-anywhere.
Use mongodb native driver instead of mongoose.