Secure updates in mongodb

is there any solution within mongodb to prevent adding new fields to the document when updating ,
i could secure the operation with nodejs before passing the new values , but isn’t there any other way in mongodb ?

Hi @Hamza_Ben_Khoud

By default mongodb uses flexible schemas, if you want to be more restrictive on some or all of the fields in your documents you can use schema validation.

2 Likes

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.