“10”堆栈附近的 Azure mongo 服务语法不正确
Azure mongo service incorrect syntax near '10' stack
我正在使用 azure mongo 服务作为数据库
连接是使用门户中提供的连接字符串建立的,基本写入操作 运行 完美,但在尝试执行登录时出现以下错误。
documents.azure.com:10250: Syntax error, incorrect syntax near '10'
我们正在使用 php 版本 5.6 和 Mongo 客户端库进行 mongo 操作
应用程序目前在 mongo 服务器设置中成功 运行 在实例本身中,我们正在尝试将数据库迁移到 azure 服务。
为什么会出现此错误?
Mongo 请求导致错误
db.name_collection.findOne({"UniqueName”:"charush"},{"_id":0,"uniqueId":1})
Azure mongo 作为数据库的服务目前处于预览阶段。我有一个与其他请求类似的案例,Azure 支持人员告诉我,目前还不支持所有请求。这就是为什么您可以拥有一些与 "pure" mongo 数据库实例完美配合的请求。
以我为例,我发现 $elemMatch 不起作用。
db.users_collections.find({
"_id": "1"
},
{
"devices": {
"$elemMatch": {
"device_id": "device_id"
}
}
})
支持人员回答了我以下回复:
Unfortunately we dont have a way to project specific elements from the array right now. We are working towards supporting $elemMatch in the project phase as well and it should be available by mid-March.
您必须了解 mongo 作为 Azure 上的服务是一种包装器,允许使用 mongoDB 协议与他们的 NoSQL 技术交互:DocumentDB,而且就像我在我回答的开头此功能仍处于预览状态。
这也是为什么您不能在 Azure mongo 服务上使用 Mongo Compass 的原因:
As DocumentDB is a fully managed service, we do not support machine management/administration operations (like addShard/ query perfCounters/ query Memory&Connections) via the MongoDB api. From our investigation, MongoCompass relies on these commands for its normal flow and does not work if any of these commands fail (even if the normal crud api succeeds). I would recommend using RoboMongo which is an opensource tool to interact with the mongo apis
因此,如果您想保留与 mongoDB api 一起使用的完全托管服务的优势,则必须等到生产版本(根据支持)或寻找其他方式来执行此查询。
我正在使用 azure mongo 服务作为数据库
连接是使用门户中提供的连接字符串建立的,基本写入操作 运行 完美,但在尝试执行登录时出现以下错误。
documents.azure.com:10250: Syntax error, incorrect syntax near '10'
我们正在使用 php 版本 5.6 和 Mongo 客户端库进行 mongo 操作
应用程序目前在 mongo 服务器设置中成功 运行 在实例本身中,我们正在尝试将数据库迁移到 azure 服务。 为什么会出现此错误?
Mongo 请求导致错误
db.name_collection.findOne({"UniqueName”:"charush"},{"_id":0,"uniqueId":1})
Azure mongo 作为数据库的服务目前处于预览阶段。我有一个与其他请求类似的案例,Azure 支持人员告诉我,目前还不支持所有请求。这就是为什么您可以拥有一些与 "pure" mongo 数据库实例完美配合的请求。
以我为例,我发现 $elemMatch 不起作用。
db.users_collections.find({
"_id": "1"
},
{
"devices": {
"$elemMatch": {
"device_id": "device_id"
}
}
})
支持人员回答了我以下回复:
Unfortunately we dont have a way to project specific elements from the array right now. We are working towards supporting $elemMatch in the project phase as well and it should be available by mid-March.
您必须了解 mongo 作为 Azure 上的服务是一种包装器,允许使用 mongoDB 协议与他们的 NoSQL 技术交互:DocumentDB,而且就像我在我回答的开头此功能仍处于预览状态。 这也是为什么您不能在 Azure mongo 服务上使用 Mongo Compass 的原因:
As DocumentDB is a fully managed service, we do not support machine management/administration operations (like addShard/ query perfCounters/ query Memory&Connections) via the MongoDB api. From our investigation, MongoCompass relies on these commands for its normal flow and does not work if any of these commands fail (even if the normal crud api succeeds). I would recommend using RoboMongo which is an opensource tool to interact with the mongo apis
因此,如果您想保留与 mongoDB api 一起使用的完全托管服务的优势,则必须等到生产版本(根据支持)或寻找其他方式来执行此查询。