Skip to main content

Querying Data

To query/analyze events, use the db.query method, which receives the following parameters:

NameDescription
1. monitor_idMonitor ID
2. collection_idCollection ID
3. query parameters objectSame as the JSON body you send to the query API

Example:

db.query("c8dagqjrjsr9pcfbn2bg", "users", {
filters: [
{
property: "age",
operator: "gt",
value: "30",
},
],
timeframe: {
from: "2021-12-16T12:27:10.602Z",
to: "2022-03-16T12:27:10.602Z",
},
order: {
by: "timestamp",
direction: "desc",
type: "numeric",
},
limit: 1,
})
.then((result) => {
console.log(result);
})
.catch((error) => {
console.log(error);
});