返回标量对象

时间:2018-10-12 16:50:11

标签: azure-cosmosdb

cosmos db中是否有任何方法可以返回标量对象而不是数组?

SELECT * FROM c where c.VesselId=40

返回:

[
    {
        "VesselId": 40,
        "LatestReportId": null,
        "Name": "xxx",        
    }
]

我想要:

{
    "VesselId": 40,
    "LatestReportId": null,
    "Name": "xxx",        
}

1 个答案:

答案 0 :(得分:0)

尝试SELECT top 1 c FROM c where c.VesselId=40SELECT top 1 VALUE c FROM c where c.VesselId=40