0

When backing up mongodb, I want to back up only the collection information about the database. Is there a way?

I am asking if there is a way to back up only the colllection without data using mongodump.

han
  • 43
  • 5

1 Answers1

1

It has been noted that MongoDB is and remains schema-less, so unless you use Mongoose or another ORM, is it difficult to get the schema directly from the data.

That being said, there is a tool called mongodb-schema that can read your documents and INFER a schema from them. It creates a probability metric for each of the potential fields and also the assigned type. It may be useful if you want to retrospectively analyse the collections without resorting to a dump and manual inspection.

You can also use MongoDB Compass to analyse your schemas. This is, again, based on the sampling of your data.

I believe this is the desired output, but for more clarity in your use case, please update the question accordingly.

dangarfield
  • 2,210
  • 1
  • 13
  • 18