I’m having an issue with the SUM() function… I can query a document list and see the list of purchase totals (ie. total purchase amount of each purchase). When I try to get the sum of the purchase totals I simply receive a null.
Here is a rough example subset of document:
{
id: 12
PurchaseHeaders
{
total: 19.95
}
}
{
id: 13
PurchaseHeaders
{
total: 10.00
}
}
when I query:
"select PurchaseHeaders.total from bucket
" I correctly receive:
total: 19.95
total: 10.00
when I query:
"select sum(PurchaseHeaders.total) as total from bucket
" I receive:
total: null
In fact it seems that any math functions return null. Here’s another example:
SELECT CartTotals.total, CartTotals.total + 10 from bucket
{
“$1”: null,
“total”: “19.95”
},
{
“$1”: null,
“total”: “10.00”
}
I’m using server 4.6