Ilan_Toren
(Ilan Toren)
November 20, 2022, 8:15pm
1
I’d like to use validation for an object that has several variants (polymorphic) it would seem that oneOf is the place to implement this (by my understanding), but I don’t see any examples of that in the documentation.
Could someone fill me in on this please?
Tarun_Gaur
(Tarun Gaur)
November 22, 2022, 8:42am
3
Hello @Ilan_Toren ,
To learn more about oneOf
, please go through Video: Schema Validation and read below threads on oneOf usage.
https://www.mongodb.com/community/forums/community/forums/t/multiple-json-schemas-with-oneof/97856?u=tarun_gaur
json, schema, jsonschema
In case you have queries or issues with this, please feel free to reach out with below details
MongoDB Version
Some example documents which should pass the schema validation
Regards,
Tarun
Ilan_Toren
(Ilan Toren)
November 23, 2022, 10:47am
4
Thanks for answering. Looks good
1 Like
system
(system)
Closed
November 28, 2022, 10:48am
5
This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.