perak / extract-mongo-schema

Extract schema from Mongo database, including foreign keys
71 stars 22 forks source link

Make system collections analyzing optional #13

Closed kindofbeard closed 4 years ago

kindofbeard commented 4 years ago

When you try to scan the "admin" DB, .listCollections() will return some system collections that are internal to MongoDB, and that even users with admin rights can't access. We can recognize them because their names start with system. (system.keys, system.version, and a few others).

The script fails when trying to scan those: MongoError: not authorized on admin to execute command { find: "system.keys ... }. That's because those collections are not supposed to be accessed, even by admin users ; see more info here: https://docs.mongodb.com/manual/reference/system-collections/

I suggest those collections are skipped by default. If one really wants to analyze them for some reason, they can use the new CLI option --include-system.

perak commented 4 years ago

Great. Thank you!

perak commented 4 years ago

@kindofbeard please update README.md accordingly. Thanks!