mongoengine icon indicating copy to clipboard operation
mongoengine copied to clipboard

Exporting Document as JSON schema

Open upcFrost opened this issue 2 years ago • 1 comments

Hi,

Is it possible to export a MongoEngine Document as a mongo-friendly JSON schema? It might be quite helpful for writing migrations and ensuring that the collection has exactly the data it should have without a bunch of corner cases.

The workflow is approximately like: write the model -> get the schema -> plug it into mongo with Warning level -> adjust -> deploy -> switch to Strict level -> repeat

upcFrost avatar Dec 23 '21 15:12 upcFrost

@upcFrost I have written a package that adds this functionality to MongoEngine documents. Check it out here: https://github.com/symphonicityy/mongoengine-jsonschema

symphonicityy avatar Jun 11 '23 09:06 symphonicityy