Skip to content

dec atomic operation on Float/Decimal/Int Field is broken #2339

Open
@ajdas-code

Description

@ajdas-code

It seems that the mongoengine is broken for atomic dec operation a FloatField or DecimalField.

Here is what i am trying -

class Account (DynamicDocument): 
    user = ReferenceField(User,passthrough=True,reverse_delete_rule=True,required=True,unique=True)
    amount = FloatField(min_value=0,required=True)

Now I am trying to perform a atomic "dec" operation. The "amnt" value is passed as 10

Account.objects(user=usr).update(dec__amount=amnt)

However, I am getting error - mongoengine.error.ValidationError: Float value is too small. Any help is greatly appreciated. Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions