I would like to use the MongoDB native schema functionality in a Node application using the MongoDB NodeJS driver.
I do not want to use Mongoose for this. Mongoose has it's own implementation of Schemas, but has different issues which makes me want to use MongoDB directly.
So far, I have only been able to find how to create a in (official) documentation using the MongoDB via the command line only. I cannot find or figure out how to do this from within a NodeJS app using the NodeJS MongoDB driver.
Also, I cannot find any documentation on how to alter the Schema if one has already been set on a collection.
Anybody know how to do this?
The official docs that I have seen about this topic can be found here:
https://docs.mongodb.com/manual/core/schema-validation/
The answer's here: https://stackoverflow.com/questions/55025621/mongodb-add-schema-for-existing-collection