CosmosDB Mongo API: select 个特定字段
CosmosDB Mongo API: select specific fields
我正在使用 Azure CosmosDB 数据资源管理器(Azure 门户 -> Azure Cosmos DB -> 数据资源管理器)。只有 JSON 个查询字符串 {"foo": "bar"}
。我怎样才能 select 仅特定字段或在那里使用 aggregate
命令?
例如,文档结构:
{
"age": 30,
"city": "Oslo"
}
我只想 select:
{
"city": "Oslo"
}
How can I select only specific field or use aggregate command there?
至select仅特定字段,请参考门户mongo shell中的以下命令:
get all data from city field with _id
db.coll.find({}, {city:1})
get all data from city field without _id
db.coll.find({}, {city:1,_id:0})
测试:
关于聚合函数,cosmos db mongo api只支持全部mongo聚合函数的一部分,请参考这个document查看支持功能。
我正在使用 Azure CosmosDB 数据资源管理器(Azure 门户 -> Azure Cosmos DB -> 数据资源管理器)。只有 JSON 个查询字符串 {"foo": "bar"}
。我怎样才能 select 仅特定字段或在那里使用 aggregate
命令?
例如,文档结构:
{
"age": 30,
"city": "Oslo"
}
我只想 select:
{
"city": "Oslo"
}
How can I select only specific field or use aggregate command there?
至select仅特定字段,请参考门户mongo shell中的以下命令:
get all data from city field with _id
db.coll.find({}, {city:1})
get all data from city field without _id
db.coll.find({}, {city:1,_id:0})
测试:
关于聚合函数,cosmos db mongo api只支持全部mongo聚合函数的一部分,请参考这个document查看支持功能。