We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I have a document where I want to decrement a field by 1, but it should never go negative. However, I can't figure out how to do this.
I tried two things (and a bunch of variations on this):
findAndModifyOpts ( select ...) FamUpdate { famUpdate = [ "$inc" =: ["count" =: ((-1) :: Int)], "$max" =: ["count" =: (0 :: Int)] ], famNew = False, famUpsert = False }
and
findAndModifyOpts ( select ...) FamUpdate { famUpdate = [ "$set" =: [ "count" =: [ "$max" =: [ "$max" =: [Int32 0, Int32 0], "$subtract" =: [String "$count", Int32 1] ] ] ] ], famNew = False, famUpsert = False }
But both end up giving a document not found error.
document not found
How do I properly do this?
The text was updated successfully, but these errors were encountered:
No branches or pull requests
I have a document where I want to decrement a field by 1, but it should never go negative. However, I can't figure out how to do this.
I tried two things (and a bunch of variations on this):
and
But both end up giving a
document not found
error.How do I properly do this?
The text was updated successfully, but these errors were encountered: