Validating transactions: Prevent negative numbers

Assuming a have a property “balance” of type Number.
I am adding/subtracting this property by using the inc operator.
Is there a way to validate transactions so that queries that would result in the property being negative are rejected?

You do not need transaction to do that.

Start with document

{ _id : 5 , balance : 300 }

So rather than doing an update such as:

collection.updateOne( { _id : 5 } ,
  { $inc : { balance : -400} } )

that would result into a new balance of -100. You simply do:

collection.updateOne( { _id : 5 , balance : { $gte : 400 } } ,
  { $inc : { balance : -400} } )

With this query the update will not occur.