A library for converting OData v4 query segments (such as $filter, $select, $skip, $top) into MongoDB query objects. Version 0.1.12 is the latest and appears to be stable but early-stage, with limited release cadence. It depends on odata-v4-parser for OData syntax parsing. Key differentiator: enables building OData v4 compliant APIs directly over MongoDB, supporting filter, select, skip, top, but not yet $expand. Includes TypeScript definitions.
npm install odata-v4-mongodbNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Create an OData v4 endpoint over MongoDB using createFilter and createQuery with Express.
Pass req.query (object) or { $filter: '...', $select: '...' }.Manually handle $orderby using MongoDB sort() after query.
Implement expand logic manually or avoid using $expand.
Use createQuery to handle $filter, $select, $skip, $top together.
Update imports to include createQuery if needed.
Use: const { createFilter } = require('odata-v4-mongodb');Run: npm install odata-v4-mongodb
Pass req.query object or { filter: req.query.$filter, select: req.query.$select }.Ensure MongoDB version >= 3.6, or sanitize inputs; avoid special regex characters.