Mongorestore问题身份验证失败

时间:2019-12-20 16:56:37

标签: mongodb

mongorestore -h ds121312.mlab.com:21312 -d heroku_jzxndzbk -u heroku_jzxndzbk -p xxxxxxxxxxxxxxx  dump/Loc8r

错误:

2019-12-20T11:36:55.931-0500    error connecting to host: could not connect to server: connection() : auth error: sasl conversation error: unable to authenticate using mechanism "SCRA
M-SHA-1": (AuthenticationFailed) Authentication failed.

我正在遵循Holmes / Harber撰写的“ Getting MEAN”文本-第152页。

有什么建议吗?谢谢

1 个答案:

答案 0 :(得分:2)

您还必须指定要用于身份验证的数据库,例如Sub test() Dim ws As Worksheet: Set ws = ThisWorkbook.Sheets("Sheet1") Dim cs As Worksheet Dim mycell As Range, RANG As Range, Mname As String, Rng As Range Dim r As Range, dict As Object Set dict = CreateObject("Scripting.Dictionary") With Sheets(1) ' Build a range (RANG) between cell F2 and the last cell in column F Set RANG = Range(.Cells(2, "A"), .Cells(.Rows.Count, "A").End(xlUp)) End With ' For each cell (mycell) in this range (RANG) For Each mycell In RANG Mname = mycell.Value ' If the count of mycell in RANG is greater than 1, then set the value of the cell 1 across to the right of mycell (i.e. column G) as "Duplicate Found" If Application.WorksheetFunction.CountIf(RANG, mycell.Value) > 1 Then If dict.Count > 0 And dict.Exists(Mname) Then dict(Mname) = mycell.Row() Else dict.Add Mname, mycell.Row() End If End If Next mycell Dim StartRow As Long StartRow = 2 Dim Key As Variant Dim lr As Long, v As Variant For Each Key In dict.Keys Set Rng = ws.Range("A" & StartRow & ":A" & dict(Key)) lr = dict(Key) v = dict.Keys 'put the keys into an array 'Create 3 Sheets, move them to the end, rename 'Loop through each name in array For Target = LBound(v) To UBound(v) - 1 '<-------why is Target always 0 here? 'Loop through each row For i = StartRow To lr 'Create Union of target rows If ws.Range("A" & i) = v(Target) Then If Not CopyMe Is Nothing Then '<---object required error at If Not copyme... Set CopyMe = Union(CopyMe, ws.Range("A" & i)) Else Set CopyMe = ws.Range("A" & i) End If End If Next i StartRow = dict(Key) + 1 'Copy the Union to Target Sheet If Not CopyMe Is Nothing Then Mname = "Name" & CStr(Target + 1) CopyMe.EntireRow.Copy Destination:=ThisWorkbook.Sheets(Mname).Range("A1") Set CopyMe = Nothing End If Next Target Next Key End Sub

参考:https://docs.mongodb.com/manual/reference/program/mongo/#cmdoption-mongo-authenticationdatabase