I have been working on a sample for a little while now that shows the use of the DevExtreme UI widgets in the context of a real-world architecture. This sample is quite complex and will be the subject of a number of future posts, but it isn't complete yet. Meanwhile, as part of the work, I implemented query logic that runs queries against a MongoDB collection and uses the load options supported by our CustomStore to parameterize the queries. If you are using MongoDB for data storage, you can take advantage of this code to automatically run the dynamic queries generated by our complex UI widgets.
const MongoClient = require("mongodb").MongoClient; const query = require("devextreme-query-mongodb"); async function queryData() { MongoClient.connect("mongodb://localhost:27017/testdatabase", (err, db) => { const results = await query(db.collection("values"), { // This is the loadOptions object - pass in any valid parameters take: 10, filter: [ "intval", ">", 47 ], sort: [ { selector: "intval", desc: true }] }); // Now "results" contains an array of ten or fewer documents from the // "values" collection that have intval > 47, sorted descendingly by intval. }); }
The code is available now in this github repository: https://github.com/oliversturm/devextreme-query-mongodb
Please check out the readme on the repository page, it has details on installation of the npm module. Please report issues, if you find them, and feel free to ask if something isn't clear to you!