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.

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

报告相同问题?

悬赏问题

  • ¥20 有关区间dp的问题求解
  • ¥15 多电路系统共用电源的串扰问题
  • ¥15 slam rangenet++配置
  • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
  • ¥15 对于相关问题的求解与代码
  • ¥15 ubuntu子系统密码忘记
  • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
  • ¥15 保护模式-系统加载-段寄存器
  • ¥15 电脑桌面设定一个区域禁止鼠标操作
  • ¥15 求NPF226060磁芯的详细资料