dongyao5843 2017-02-15 08:57
浏览 49
已采纳

Azure mongodb服务'10'堆栈附近的语法不正确

I'm using azure mongo service as database

Connection was established using connect string provided in the portal, basic write operations are running perfectly but when trying to perform signing in I'm getting the following error.

documents.azure.com:10250: Syntax error, incorrect syntax near '10'

We are using php version 5.6 and Mongo Client library for mongo operation

The application is currently successfully running in mongo server setup in instance itself we are trying to migrate the db to azure service. Why is this error occuring ?

Mongo request causing error

db.name_collection.findOne({"UniqueName”:"charush"},{"_id":0,"uniqueId":1})

  • 写回答

1条回答 默认 最新

  • doujiabing1228 2017-02-24 14:25
    关注

    Azure mongo service as database is currently in preview. I had a similar case with an other request and the Azure support told me that all requests are not supported yet. That's why you can have some requests that perfectly work with a "pure" mongoDB instance.

    In my case for example I discovered that the $elemMatch doesn't work.

    db.users_collections.find({
        "_id": "1"
    },
    {
        "devices": {
            "$elemMatch": {
                 "device_id": "device_id"
             }
         }
     })
    

    The support answered me this following response :

    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.

    You have to understand that mongo as service on Azure is a kind of wrapper to allow to use the mongoDB protocols to interact with their NoSQL technology : DocumentDB, moreover like I said in the beginning of my answer this feature is still in preview. That's also why for example you can't use Mongo Compass on Azure mongo service :

    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

    So, if you want to keep the advantage to have a fully managed service which works with mongoDB api, you have to wait until the production version (Mid-march according to the support) or find an other way to execute this query.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 Attention is all you need 的代码运行
  • ¥15 一个服务器已经有一个系统了如果用usb再装一个系统,原来的系统会被覆盖掉吗
  • ¥15 使用esm_msa1_t12_100M_UR50S蛋白质语言模型进行零样本预测时,终端显示出了sequence handled的进度条,但是并不出结果就自动终止回到命令提示行了是怎么回事:
  • ¥15 前置放大电路与功率放大电路相连放大倍数出现问题
  • ¥30 关于<main>标签页面跳转的问题
  • ¥80 部署运行web自动化项目
  • ¥15 腾讯云如何建立同一个项目中物模型之间的联系
  • ¥30 VMware 云桌面水印如何添加
  • ¥15 用ns3仿真出5G核心网网元
  • ¥15 matlab答疑 关于海上风电的爬坡事件检测