Registry / database / devextreme-query-mongodb

devextreme-query-mongodb

JSON →
library2.0.16jsnpmunverified

Query MongoDB collections using DevExtreme data store load parameters. Current stable version: 2.0.16. Release cadence: infrequent, mostly maintenance. Key differentiator: directly translates DevExtreme loadOptions (filtering, sorting, paging, grouping) into MongoDB aggregation pipeline and queries, handling complex nested logic. Requires babel-polyfill for v2.x. Alternative to building custom server-side query translation for DevExtreme data layer.

npm install devextreme-query-mongodb
INSTALL
IMPORT
SIG · DEVEXTREME-QUERY-M
D
devextreme-query-mongodb
databasejavascriptv2.0.16
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

default
import query from 'devextreme-query-mongodb'
import { query } from 'devextreme-query-mongodb'
Default export is a function; named export is incorrect.
default
const query = require('babel-polyfill'); const query = require('devextreme-query-mongodb');
const query = require('devextreme-query-mongodb'); // missing babel-polyfill in v2.x
v2.x requires babel-polyfill initialization before loading this library.
default
import query from 'devextreme-query-mongodb'
const query = require('devextreme-query-mongodb').default;
CommonJS require returns the function directly, no .default needed.

Query MongoDB collection 'myCollection' using DevExtreme loadOptions with filter, sort, paging, and skip.

import { MongoClient } from 'mongodb'; import query from 'devextreme-query-mongodb'; async function run() { const client = await MongoClient.connect('mongodb://localhost:27017', { useUnifiedTopology: true }); const collection = client.db('myDB').collection('myCollection'); const loadOptions = { filter: ['status', '=', 'active'], sort: 'createdAt', take: 10, skip: 0 }; const results = await query(collection, loadOptions); console.log(results); await client.close(); } run().catch(console.error);
Debug
Known issues
breakingv2.x requires babel-polyfill to be loaded before use. Without it, the library throws errors about missing Symbol, Promise, or other ES6 features.
fix
Add 'import babel-polyfill' or 'require(babel-polyfill)' as the first line of your application code.
affects: >=2.0.0
breakingv1.x requires Node.js >=7.3 with --harmony flag for async/await support.
fix
Upgrade to v2.x or use Node.js 8.x+ without --harmony.
affects: <2.0.0
gotchaThe library assumes MongoDB collection is a valid collection object from the official mongodb driver. Passing a different object (e.g., from mongoose) may cause unexpected behavior.
fix
Use collection directly from MongoClient.connect(), not from an ODM wrapper.
affects: *
deprecatedThe library does not support the group summary feature of DevExtreme data sources in v1.x; group summary is only added in v2.x with limitations.
fix
Check documentation for group summary configuration; if not working, upgrade to latest patch.
affects: >=2.0.0 <2.1.0
gotchaFilter expressions with parentheses for grouping (e.g., [['price','<',10], 'or', ['stock','>','0']]) must be flat arrays. Nested arrays may not parse correctly.
fix
Use the flat array representation as documented by DevExtreme.
affects: *
Errors
Common errors & fixes
ReferenceError: regeneratorRuntime is not defined
Missing babel-polyfill in v2.x or incorrect polyfill setup.
fix
Add 'import babel-polyfill' or 'require('babel-polyfill')' at the entry point before loading this library.
TypeError: collection.aggregate is not a function
Passing a mongoose model or other non-native collection object instead of a MongoDB collection.
fix
Use the native collection from MongoClient.db().collection('name').
SyntaxError: Unexpected token function (or async/await issues)
Running Node.js <7.3 without --harmony flag (v1.x) or missing babel-polyfill/transform.
fix
Upgrade to Node.js >=7.3 and pass --harmony or upgrade to v2.x with babel-polyfill.
Error: MongoError: unknown operator: $text
Using default MongoDB collection without a text index when loadOptions contains a filter with condition on non-indexed fields
fix
Create a text index on the collection for text filters or avoid using $text operators incorrectly.
Upgrade
Version history
2.0.16latest on npm
Audit
Dependencies
babel-polyfilloptionalRequired for v2.x to polyfill ES6 features in older Node.js versions
Agent activity
5 hits · last 30 days
node
4
Resources
devextreme-query-mongodb — npm install devextreme-query-mongodb · libregistry