Querying Data
To query/analyze events, use the db.query
method, which receives the following parameters:
Name | Description |
---|---|
1. monitor_id | Monitor ID |
2. collection_id | Collection ID |
3. query parameters object | Same 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);
});