I created a collection also defined validation rule for the collection using $jsonSchema now when I exported the collection and import in another database i am not seeing the #jsonschema defined in my source database not getting imported in destination DB is there any other way of doing it or i am missing anything here please do guide me
Mongoexport is a tool for generally just getting data out, I’m not sure it’ll do that. We use it for exporting to CSV etc for feeding to other systems or it’ll also output to JSON format.
Mongodump however, will do a lot more, i.e. rebuild indexes on restore etc.
Testing locally, I created a collection with a validator, dumped it using mongodump and restored it somewhere else, the new location had the schema validator included.
Thanks john for the reply didn’t try with Mongodump . I thought how oracle export works similarly Mongoexport also works.