【发布时间】:2019-08-31 01:07:16
【问题描述】:
我在 OS X 上,正在尝试使用基于 Node.js 的 MongoClient 连接到在 Parallels VM 中运行的 CosmosDB 模拟器。我能够连接它,但查询失败并出现身份验证错误。
我首先查看了this document,但我必须对其进行一些修改才能让我的主机连接到虚拟机:
Microsoft.Azure.Cosmos.Emulator.exe /AllowNetworkAccess /EnableMongoDbEndpoint /Key=C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==
我的连接字符串:
mongodb://vm1:C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==@vm1:10255/admin?ssl=true
在我能够连接之后,我不知道如何使用MongoClient 提供与ServerCertificateCustomValidationCallback 等效的功能。
我收到的身份验证错误消息:
[8/31/19 12:40:54 AM] System.Private.CoreLib: Exception while executing function: Functions.datasets. System.Private.CoreLib: Result: Failure
[8/31/19 12:40:54 AM] Exception: MongoError: Authentication Failed. ConnectionId 1a87b001-e1e6-4918-9a1c-92db5719c670 ActivityId: 8c071a01-0000-0000-0000-000000000000
[8/31/19 12:40:54 AM] Stack: MongoError: Authentication Failed. ConnectionId 1a87b001-e1e6-4918-9a1c-92db5719c670 ActivityId: 8c071a01-0000-0000-0000-000000000000
[8/31/19 12:40:54 AM] at /Users/Documents/Projects/DataStore/node_modules/mongodb-core/lib/connection/pool.js:598:61
[8/31/19 12:40:54 AM] at authenticateStragglers (/Users/Documents/Projects/DataStore/node_modules/mongodb-core/lib/connection/pool.js:516:16)
[8/31/19 12:40:54 AM] at Connection.messageHandler (/Users/Documents/Projects/DataStore/node_modules/mongodb-core/lib/connection/pool.js:552:5)
[8/31/19 12:40:54 AM] at emitMessageHandler (/Users/Documents/Projects/DataStore/node_modules/mongodb-core/lib/connection/connection.js:309:10)
[8/31/19 12:40:54 AM] at TLSSocket.<anonymous> (/Users/Documents/Projects/DataStore/node_modules/mongodb-core/lib/connection/connection.js:452:17)
[8/31/19 12:40:54 AM] at TLSSocket.emit (events.js:182:13)
[8/31/19 12:40:54 AM] at addChunk (_stream_readable.js:283:12)
[8/31/19 12:40:54 AM] at readableAddChunk (_stream_readable.js:264:11)
[8/31/19 12:40:54 AM] at TLSSocket.Readable.push (_stream_readable.js:219:10)
[8/31/19 12:40:54 AM] at TLSWrap.onStreamRead (internal/stream_base_commons.js:94:17).
【问题讨论】:
标签: azure-cosmosdb azure-cosmosdb-mongoapi