f mogodb dump/restore --備出test , restore 回supplies ~ 迪貝之家

mogodb dump/restore --備出test , restore 回supplies

 

C:\mongodb\bin\mongodump --uri "mongodb+srv://steven:xxxxx@mymongo.xxxx.mongodb.net/test"

2021-03-26T22:35:57.153-0700 WARNING: On some systems, a password provided directly in a connecti
on string or using --uri may be visible to system status programs such as `ps` that may be invoked b
y other users. Consider omitting the password to provide it via stdin, or using the --config option
to specify a configuration file with the password.
2021-03-26T22:36:02.216-0700 writing test.sales to dump\test\sales.bson
2021-03-26T22:36:03.176-0700 [........................] test.sales 0/5000 (0.0%)
2021-03-26T22:36:06.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:09.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:12.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:15.173-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:18.173-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:21.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:24.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:27.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:30.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:33.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:36.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:39.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:42.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:45.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:48.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:51.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:54.173-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:36:57.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:37:00.173-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:37:03.173-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:37:06.173-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:37:09.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:37:12.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:37:15.173-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:37:18.172-0700 [........................] test.sales 101/5000 (2.0%)
2021-03-26T22:37:20.247-0700 [########################] test.sales 5000/5000 (100.0%)
2021-03-26T22:37:20.248-0700 done dumping test.sales (5000 documents)


C:\Users\IEUser\Desktop\dump\test>cd ..
C:\Users\IEUser\Desktop\dump>xcopy /E /I test supplies
test\sales.bson
test\sales.metadata.json
2 File(s) copied

C:\Users\IEUser\Desktop\dump>dir
Volume in drive C is Windows 81
Volume Serial Number is FC92-3303
Directory of C:\Users\IEUser\Desktop\dump
03/26/2021 10:44 PM <DIR> .
03/26/2021 10:44 PM <DIR> ..
03/26/2021 10:44 PM <DIR> supplies
03/26/2021 10:36 PM <DIR> test
0 File(s) 0 bytes
C:\Users\IEUser\Desktop\dump>cd ..
C:\Users\IEUser\Desktop>dir dump
Volume in drive C is Windows 81
Volume Serial Number is FC92-3303
Directory of C:\Users\IEUser\Desktop\dump
03/26/2021 10:44 PM <DIR> .
03/26/2021 10:44 PM <DIR> ..
03/26/2021 10:44 PM <DIR> supplies
03/26/2021 10:36 PM <DIR> test
0 File(s) 0 bytes
4 Dir(s) 42,106,376,192 bytes free

C:\Users\IEUser\Desktop>C:\mongodb\bin\mongorestore --uri "mongodb+srv://steven:xxx@mymongo.xxx.mongodb.net" -d sample_supplies dump\supplies

2021-03-26T22:48:48.676-0700 The --db and --collection flags are deprecated for this use-case; pl
ease use --nsInclude instead, i.e. with --nsInclude=${DATABASE}.${COLLECTION}
2021-03-26T22:48:48.685-0700 building a list of collections to restore from dump\supplies dir
2021-03-26T22:48:48.886-0700 reading metadata for sample_supplies.sales from dump\supplies\sales.
metadata.json
2021-03-26T22:48:49.086-0700 restoring sample_supplies.sales from dump\supplies\sales.bson
2021-03-26T22:48:51.272-0700 [#########...............] sample_supplies.sales 1.66MB/4.13MB (4
0.3%)
2021-03-26T22:48:53.013-0700 [########################] sample_supplies.sales 4.13MB/4.13MB (1
00.0%)
2021-03-26T22:48:53.019-0700 no indexes to restore
2021-03-26T22:48:53.021-0700 finished restoring sample_supplies.sales (5000 documents, 0 failures
)
2021-03-26T22:48:53.025-0700 5000 document(s) restored successfully. 0 document(s) failed to rest
ore.