我是mongo
的新用户,并尝试restore/import
以下bson files
到mongo版本3.0.6
,
但是当我尝试下面的选项时,它失败并出现以下错误:请参考屏幕截图。仅供参考 - 我以管理员身份运行CMD。
C:\Program Files\MongoDB\Server\3.0\bin>mongorestore -h localhost C:\dump\sampledb\
2016-03-22T01:01:49.266+0530 building a list of dbs and collections to restore from C:\dump\sampledb dir
2016-03-22T01:01:49.268+0530 don't know what to do with file "C:\dump\sampledb\categories.bson", skipping...
2016-03-22T01:01:49.269+0530 don't know what to do with file "C:\dump\sampledb\customers.bson", skipping...
2016-03-22T01:01:49.269+0530 don't know what to do with file "C:\dump\sampledb\employee-territories.bson", skipping...
2016-03-22T01:01:49.270+0530 don't know what to do with file "C:\dump\sampledb\employees.bson", skipping...
2016-03-22T01:01:49.271+0530 don't know what to do with file "C:\dump\sampledb\order-details.bson", skipping...
2016-03-22T01:01:49.271+0530 don't know what to do with file "C:\dump\sampledb\orders.bson", skipping...
2016-03-22T01:01:49.272+0530 don't know what to do with file "C:\dump\sampledb\products.bson", skipping...
2016-03-22T01:01:49.272+0530 don't know what to do with file "C:\dump\sampledb\regions.bson", skipping...
2016-03-22T01:01:49.273+0530 don't know what to do with file "C:\dump\sampledb\shippers.bson", skipping...
2016-03-22T01:01:49.274+0530 don't know what to do with file "C:\dump\sampledb\suppliers.bson", skipping...
2016-03-22T01:01:49.274+0530 don't know what to do with file "C:\dump\sampledb\system.indexes.bson", skipping...
2016-03-22T01:01:49.275+0530 don't know what to do with file "C:\dump\sampledb\territories.bson", skipping...
2016-03-22T01:01:49.275+0530 done
C:\Program Files\MongoDB\Server\3.0\bin>
请指导。我已经从链接MongoDB commands from DOS or Windows获得了帮助,但到目前为止解决方案对我有用。请帮忙。
答案 0 :(得分:0)
你只需要在下面使用。我保证这会奏效。我假设您使用链接中的相同bson文件:https://github.com/tmcnab/northwind-mongo
C:\Program Files\MongoDB\Server\3.0\bin>mongorestore -h localhost -d boot -o C:\dump\sampledb\
其中:-d boot,boot是数据库名称。你可以给任何名字。
供参考:
C:\Program Files\MongoDB\Server\3.0\bin>mongorestore -h localhost -d boot C:\dump\sampledb\
2016-03-22T01:10:08.999+0530 building a list of collections to restore from C:\dump\sampledb\ dir
2016-03-22T01:10:09.000+0530 no metadata file; reading indexes from C:\dump\sampledb\system.indexes.bson
2016-03-22T01:10:09.001+0530 no metadata file; reading indexes from C:\dump\sampledb\system.indexes.bson
2016-03-22T01:10:09.016+0530 restoring boot.order-details from file C:\dump\sampledb\order-details.bson
2016-03-22T01:10:09.017+0530 restoring boot.orders from file C:\dump\sampledb\orders.bson
2016-03-22T01:10:09.018+0530 no metadata file; reading indexes from C:\dump\sampledb\system.indexes.bson
2016-03-22T01:10:09.018+0530 no metadata file; reading indexes from C:\dump\sampledb\system.indexes.bson
2016-03-22T01:10:09.036+0530 restoring boot.products from file C:\dump\sampledb\products.bson
2016-03-22T01:10:09.037+0530 restoring boot.customers from file C:\dump\sampledb\customers.bson
2016-03-22T01:10:11.713+0530 restoring indexes for collection boot.customers from metadata
2016-03-22T01:10:11.739+0530 restoring indexes for collection boot.orders from metadata
2016-03-22T01:10:11.740+0530 restoring indexes for collection boot.products from metadata
2016-03-22T01:10:11.766+0530 restoring indexes for collection boot.order-details from metadata
2016-03-22T01:10:11.824+0530 finished restoring boot.customers (91 documents)
2016-03-22T01:10:11.825+0530 finished restoring boot.orders (830 documents)
2016-03-22T01:10:11.825+0530 finished restoring boot.order-details (2155 documents)
2016-03-22T01:10:11.825+0530 finished restoring boot.products (77 documents)
2016-03-22T01:10:11.920+0530 no metadata file; reading indexes from C:\dump\sampledb\system.indexes.bson
2016-03-22T01:10:11.923+0530 no metadata file; reading indexes from C:\dump\sampledb\system.indexes.bson
2016-03-22T01:10:11.931+0530 no metadata file; reading indexes from C:\dump\sampledb\system.indexes.bson
2016-03-22T01:10:11.938+0530 no metadata file; reading indexes from C:\dump\sampledb\system.indexes.bson
2016-03-22T01:10:11.945+0530 restoring boot.employees from file C:\dump\sampledb\employees.bson
2016-03-22T01:10:11.950+0530 restoring boot.territories from file C:\dump\sampledb\territories.bson
2016-03-22T01:10:11.957+0530 restoring boot.suppliers from file C:\dump\sampledb\suppliers.bson
2016-03-22T01:10:11.960+0530 restoring boot.categories from file C:\dump\sampledb\categories.bson
2016-03-22T01:10:14.965+0530 [########################] boot.employees 8.1 KB/8.1 KB (100.0%)
2016-03-22T01:10:14.967+0530 [########################] boot.territories 4.6 KB/4.6 KB (100.0%)
2016-03-22T01:10:14.972+0530 [########################] boot.categories 3.1 KB/3.1 KB (100.0%)
2016-03-22T01:10:14.977+0530 [########################] boot.suppliers 9.2 KB/9.2 KB (100.0%)
2016-03-22T01:10:14.982+0530
2016-03-22T01:10:14.987+0530 restoring indexes for collection boot.suppliers from metadata
2016-03-22T01:10:14.992+0530 restoring indexes for collection boot.territories from metadata
2016-03-22T01:10:14.997+0530 restoring indexes for collection boot.categories from metadata
2016-03-22T01:10:15.001+0530 restoring indexes for collection boot.employees from metadata
2016-03-22T01:10:15.005+0530 finished restoring boot.suppliers (29 documents)
2016-03-22T01:10:15.008+0530 no metadata file; reading indexes from C:\dump\sampledb\system.indexes.bson
2016-03-22T01:10:15.012+0530 finished restoring boot.categories (8 documents)
2016-03-22T01:10:15.022+0530 no metadata file; reading indexes from C:\dump\sampledb\system.indexes.bson
2016-03-22T01:10:15.025+0530 finished restoring boot.territories (53 documents)
2016-03-22T01:10:15.031+0530 no metadata file; reading indexes from C:\dump\sampledb\system.indexes.bson
2016-03-22T01:10:15.034+0530 restoring boot.employee-territories from file C:\dump\sampledb\employee-territories.bson
2016-03-22T01:10:15.042+0530 restoring boot.shippers from file C:\dump\sampledb\shippers.bson
2016-03-22T01:10:15.048+0530 finished restoring boot.employees (12 documents)
2016-03-22T01:10:15.161+0530 restoring boot.regions from file C:\dump\sampledb\regions.bson
2016-03-22T01:10:15.858+0530 restoring indexes for collection boot.employee-territories from metadata
2016-03-22T01:10:16.462+0530 restoring indexes for collection boot.shippers from metadata
2016-03-22T01:10:16.466+0530 finished restoring boot.shippers (3 documents)
2016-03-22T01:10:16.666+0530 restoring indexes for collection boot.regions from metadata
2016-03-22T01:10:16.670+0530 finished restoring boot.regions (4 documents)
2016-03-22T01:10:17.413+0530 finished restoring boot.employee-territories (49 documents)
2016-03-22T01:10:17.416+0530 done