For example this one? This question is for mongodb. I cant seem to make it work on native query.
Hi @driggsss
MongoDB has limited support in the GUI, so you would have to use Native query to do such calculation.
Hello @flamber is there any doc for constructing native queries? The most easiest way that I can think of is to have the both questions into 2 separate variables but I'm having trouble making it work or if that is possible
@driggsss It's Mongo native query, the actual JSON. You should check the Mongo documentation. How would you make the query on Mongo directly?
Example:
[
{
"$project": {
"mydiff": {
"$subtract": ["$total", "$subtotal"]
}
}
},
{
"$group": {
"_id": null,
"totalDiff": { "$sum": "$mydiff" }
}
}
]