aggregate
This method can be used to aggregate nodes, and maps to the underlying schema Aggregate.
Example
Find the longest User name:
const User = ogm.model("User");
const usersAggregate = await User.aggregate({
aggregate: {
name: {
longest: true
}
}
});
Find the longest User name where name starts with the letter "D":
const User = ogm.model("User");
const usersAggregate = await User.aggregate({
where: {
name_STARTS_WITH: "D"
},
aggregate: {
name: {
longest: true
}
}
});
Arguments
Name and Type | Description |
---|---|
|
A JavaScript object representation of the GraphQL |
Was this page helpful?