Version 4 - SQL SUM Arithmetic Operation

Dony perdana shared this problem 5 years ago
Cannot Reproduce

if I run SQL Query like this:

mb.runSQLQuery("SELECT (SUM(num1+ num2)) as total FROM test_1 GROUP BY Id, num1, num2")

it will return this: "message" : "$add only supports numeric or date types, not string",

is SQL arithmetic operation is not supported?

Replies (3)


I tried with my local MongoDB 3.2 and 3.4 db, but can't recall the issue.

Could you please give me detailed steps and sample data to recall the issue?


I'm using 3 version, 3.4.0, 3.4.2, and 3.4.4.

on 3.4.4 working properly, but on the other version is not.


I tried with MongoDB 3.4.2. But still can't recall the issue.

My Data:


"_id" : ObjectId("59d4479f449e4912607df896"),

"num1" : 1.0,

"num2" : 2.0


Could you please give me one or two sample docs to recall the issue? I

Leave a Comment
Attach a file