Pergunta

I have dumped my project's mongo db database into my machine and want to extract the schema and models from the dumped database.

Is there any method in mongo db to get the schema back with the help of dumped database.

Any suggestions or feedbacks in this regard would be appreciated.

Foi útil?

Solução

Is it not possible for you to restore the data into a MongoDB instances and look at the data again?

Not sure what you mean by schema, since MongoDB is very flexible on schema. From the nature of youu question, it looks like the schema is defined in mongoose and not exactly in MongoDB per-se and you are trying to reverse engineer that mongoose schema based on the data contained in the dump.

If you do not want to start a new instance and import the data, another option could be using bsondump utility that comes as part of MongoDB package to convert the BSON dump files to JSON format and analyzing them.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top