Skip to content

Toggle Boolean findOneAndUpdate #10099

Answered by vkarpov15
moomoolive asked this question in Q&A
Discussion options

You must be logged in to vote

Not atomically, I think your best bet would be to make isCool a number and use bitwise operators: https://docs.mongodb.com/manual/reference/operator/update/bit/#mongodb-update-up.-bit if you need to atomically toggle a boolean.

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@moomoolive
Comment options

Answer selected by Uzlopak
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants