- Way1
db.getCollectionNames()- Way2
| /* | |
| Please advise me better coding style and syntax, thanks! | |
| Process Flow: | |
| 1. prepare readyToCreateIndexes which contains one or more indexes | |
| 2. get all current indexes and compare keyName and key field | |
| - keyName | |
| - not exist: | |
| - fields different, insert! |
| #!/bin/bash | |
| host=127.0.0.1 | |
| port=27017 | |
| authDB=admin | |
| db=[YourDB] | |
| user=root | |
| pwd=[YourPassword] | |
| source_folder="./MongoDBBackup/${db}/" |
| #!/bin/bash | |
| host=127.0.0.1 | |
| port=27017 | |
| authDB=admin | |
| db=[YourDB] | |
| user=root | |
| pwd=[YourPassword] | |
| collections="[Collection1] [Collection2]" | |
| output_folder="./export/" |