I have following document structure:
{
"moneys": {
"someKey": NumberDecimal(99)
...
"someOtherRandomKey": NumberDecimal(99)
}
{
What I want: When nonexistent field increments, create that field with
NumberDecimal
value.
I tried it with scala driver but cant do that:
//not compiles
collection.findOneAndUpdate(filters,Updates.inc("someOtherKey", new Decimal128(50)))
because Updates.inc(k,v)
requires Number
; Decimal128
is not Number
I think problem not in driver, but with my logic.
How can I implement my case with scala/java driver?