mongodb compare indexes

Prepared and published the module for comparing two mongodb instances and publishing the indexes discrepancies between them (e.g. what is missing in the source server and what is missing in the destination).

Module name is mongo-compare-indexes

The usage is pretty straight forward. You either define the URLs along with the command:

npx mongo-compare-indexes run mongodb://localhost:27017/db_name_source mongodb://localhost:27017/db_name_target

or you define the ENV variable first (they are TARGET_MONGO_URL and SOURCE_MONGO_URL). Example:

export TARGET_MONGO_URL="mongodb://user:pass@host:port/db_name"
export SOURCE_MONGO_URL="mongodb://localhost/db_name"

and then just use:

npx mongo-compare-indexes run

2025-05-31