Collection of mongodb scripts
These scripts require at least Mongo Shell 3.6. The scripts will not work on Mongo Shell of a lower version. They have been tried against source MongoDB Server versions 3.0, 3.2, 3.4, 3.6.
The steps performed in the verification script are outlined below
- For each collection in the whitelisted databases (note, supply null as whitelist to process all databases)
- Select a random set of _id from the given collection. The selection is run on the source collection and runs against the _id index. The selection is configured by supplying,
- Total sample size
- Number of sections to partition the collection space
- The script will pick up a proportional number of documents from each partition.
- If the requested sample size is larger than the collection size, then all the collection will be considered.
- Using the chosen _id’s, the script will run the following process on both the source and the destination databases,
- Find the required documents.
- Order all the keys in the document in alphabetical order (to counteract the different behavior between MongoDB 3.0 and MongoDB 4.4).
- Output the result into a temporary output collection.
- Generate the dbHash for the output collections.
- Compare dbHash’es and report.
- Select a random set of _id from the given collection. The selection is run on the source collection and runs against the _id index. The selection is configured by supplying,
The steps performed in the verification script are outlined below
- For each collection in the whitelisted databases (note, supply null as whitelist to process all databases)
- Count the number of documents in the given collection on the source database.
- Count the number of documents in the given collection on the destination database.
- Compare counts and report.
The steps performed in the verification script are outlined below
- For each collection in the whitelisted databases (note, supply null as whitelist to process all databases)
- Extract the getCollectionInfos(..) and getIndexes() output for the given collection on the source database.
- Extract the getCollectionInfos(..) and getIndexes() output for the given collection on the destination database.
- Compare outputs as a JSON string and report.