【问题标题】:as query not supporting in cosmos db作为 cosmos db 中不支持的查询
【发布时间】:2019-09-25 12:53:09
【问题描述】:

我正在尝试使用以下代码来获取详细信息,但它没有返回我想要的。

我的查询:

   var query = $"SELECT catalog.id as vendorguid,catalog.VendorName,industry.Id as industryguid,industry.IdustryId,industry.IdustryName,category.id as categoryguid,category.Name as categoryname,category.Description as categorydescription,Subcategory.Id as subcategoryguid,Subcategory.Name as subcategoryname,Subcategory.Description as subcategorydescription,product.Id as productguid,product.Name as productname,product.CurrentQuantity as productCurrentQuantity,product.Tag as productTag,product.ImageUrl as productImageUrl,product.Unit as productUnit,product.Price as productPrice,product.hasMethodOfPreparation as producthasMethodOfPreparation,product.MethodOfPreparation as productMethodOfPreparation,product.Addons as productAddons FROM catalogjoin industry in catalog.Industy join category in industry.Category join Subcategory in category.Subcategoryjoin product in Subcategory.Product where product.Id = '"+productId+"'";

我的服务等级:

输出:

{
      "id": "d91af3e6-6aae-4d10-9ba6-6b97ca4cd881",
      "vendorName": "string",
      "industy": []
    }

预期输出:

{
        "vendorguid": "97392a23-c8c4-4a7f-bffb-7c3807cc40de",
        "VendorName": "string",
        "industryguid": "f8265ee6-a351-4036-a0ee-10ec4f51ecf4",
        "IdustryId": 0,
        "IdustryName": "string",
        "categoryguid": "ce7edfdf-1608-4a8c-ae38-7ca60c43bc30",
        "categoryname": "string",
        "categorydescription": "string",
        "subcategoryguid": "709f4e6f-1bba-421f-8dc0-7cf067cbc032",
        "subcategoryname": "string",
        "subcategorydescription": "string",
        "productguid": "d24dd340-d7a2-42e5-b84a-1ee72d9840c6",
        "productname": "string",
        "productCurrentQuantity": 0,
        "productTag": "string",
        "productImageUrl": [
            "string"
        ],
        "productUnit": 0,
        "productPrice": 0,
        "producthasMethodOfPreparation": true,
        "productMethodOfPreparation": [               
        ],
        "productAddons": [              
        ]
    }
我怎样才能得到它有人帮助我吗?

【问题讨论】:

  • 能否使用数据资源管理器在 Azure 门户上运行查询?
  • 是的。它正在返回数据资源管理器中的值
  • 现在我更正它。请帮我完成上述一项

标签: azure-cosmosdb


【解决方案1】:

我认为问题在于您的联接(类别、子类别)。你确定它总能找到匹配吗?如果它没有找到匹配项或没有该属性,CosmosDb 将将其包含在结果集中。

它不像 MSSQL 中包含空值的左连接。 CosmosDb 更像是完全外连接(交叉连接)。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-09-24
    • 2018-12-17
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多