I wanna make schema validation in mongoDB for double precision which modify value.
Like if I insert or update a double value 12.1111 it will save as 12.11 like we can do this in mysql DOUBLE(10, 2) when creating table.
I got answer like these but I wanna do it in schema if possible
$roundedDouble = round($double, 2);
$document = ['double' => $roundedDouble];
$collection->insertOne($document);
You can add validation with
multipleOfin your JSON Schema defintionsomething like