[JAVA-3773] Is there a way to create a $jsonSchema validator for a collection based on its data? Created: 29/Jun/20  Updated: 03/Jul/20  Resolved: 02/Jul/20

Status: Closed
Project: Java Driver
Component/s: API
Affects Version/s: None
Fix Version/s: None

Type: Task Priority: Major - P3
Reporter: Kai Dauberschmidt Assignee: Durran Jordan
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified


 Description   

Hello, 

I know there are ways to create a schema from collection even in a JSON fashion, but is there a way to actually create a $jsonSchema that can be used as a validator in a collection? 

If so, how does one achieve this? 



 Comments   
Comment by Kai Dauberschmidt [ 03/Jul/20 ]

what would you recommend as a scalable and reliable tool for schema extraction? 

Comment by Durran Jordan [ 02/Jul/20 ]

The only way to achieve this would be to use Compass or the mongodb-schema Node.js package to create the schema and then take that and convert it to a $jsonSchema oneself. I would suggest opening a ticket in the COMPASS project to ask for a feature to generate the $jsonSchema itself.

Generated at Thu Feb 08 09:00:24 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.