我下載了一個mongodb轉儲文件。現在我正試圖將文件從轉儲文件移動到我的mongodb位置。我正在使用mongorestore --dbpath [mongodb path] [轉儲路徑] cmd來執行此操作。但是我在命令提示符中看到了太多位置選項錯誤。任何人都可以幫助我解決這個問題。做「mongorestore」時,「太多位置選項」是什麼意思?
這是命令行錯誤:
C:\Documents and Settings\>mongorestore -dbpath C:\Program Files\Mon
goDb\data\db C:\Documents and Settings\My Documents\localadventure
s\localadventures
ERROR: too many positional options
Import BSON files into MongoDB.
我今天又試了一次,在我的命令提示符看到以下消息:
C:\>mongorestore --dbpath "C:\Program Files\MongoDb\data\db" "C:\Documents and S
ettings\seemanapallik\My Documents\localadventures\localadventures"
Mon Dec 23 09:05:01.515 [tools] C:\Documents and Settings\seemanapallik\My Docum
ents\localadventures\localadventures\adventure.bson
Mon Dec 23 09:05:01.515 [tools] going into namespace [localadventures.ad
venture]
Mon Dec 23 09:05:01.531 [tools] warning: Restoring to localadventures.adventure
without dropping. Restored data will be inserted without raising errors; check y
our server log
1 objects found
Mon Dec 23 09:05:01.546 [tools] Creating index: { key: { _id: 1 }, ns: "
localadventures.adventure", name: "_id_" }
Mon Dec 23 09:05:01.546 [tools] C:\Documents and Settings\seemanapallik\My Docum
ents\localadventures\localadventures\patch_version.bson
Mon Dec 23 09:05:01.546 [tools] going into namespace [localadventures.pa
tch_version]
Mon Dec 23 09:05:01.546 [tools] warning: Restoring to localadventures.patch_vers
ion without dropping. Restored data will be inserted without raising errors; che
ck your server log
2 objects found
Mon Dec 23 09:05:01.562 [tools] Creating index: { key: { _id: 1 }, ns: "
localadventures.patch_version", name: "_id_" }
Mon Dec 23 09:05:01.562 [tools] C:\Documents and Settings\seemanapallik\My Docum
ents\localadventures\localadventures\PaxHeader\adventure.bson
Mon Dec 23 09:05:01.562 [tools] going into namespace [PaxHeader.adventur
e]
assertion: 16619 code FailedToParse: FailedToParse: Expecting '{': offset:0
Mon Dec 23 09:05:01.578 dbexit:
Mon Dec 23 09:05:01.578 [tools] shutdown: going to close listening sockets...
Mon Dec 23 09:05:01.578 [tools] shutdown: going to flush diaglog...
Mon Dec 23 09:05:01.578 [tools] shutdown: going to close sockets...
Mon Dec 23 09:05:01.578 [tools] shutdown: waiting for fs preallocator...
Mon Dec 23 09:05:01.578 [tools] shutdown: closing all files...
Mon Dec 23 09:05:01.609 [tools] closeAllFiles() finished
Mon Dec 23 09:05:01.609 [tools] shutdown: removing fs lock...
Mon Dec 23 09:05:01.609 dbexit: really exiting now
我懷疑你的'轉儲路徑'包含空格嗎? – bsd
如果包含完整的命令行,它會有所幫助。該錯誤意味着給出的命令行參數數量與您指定的選項不匹配。如@bsd所述,這可能是dbpath或轉儲路徑中的空格。請注意,如果您不恢復到正在運行的MongoDB實例,則只應指定'--dbpath'。 'dbpath'選項直接訪問數據文件。 – Stennie
@Stennie:我實際上正在嘗試恢復到正在運行的MongoDB實例。那麼,在這種情況下,我應該使用什麼選項來代替dbpath? – Newbee