Reputation: 215
I'm using Azure CosmosDB Data explorer (Azure Portal -> Azure Cosmos DB -> Data Explorer). There're only JSON query string {"foo": "bar"}
. How can I select only specific field or use aggregate
command there?
e.g., document structure:
{
"age": 30,
"city": "Oslo"
}
and I would to select only:
{
"city": "Oslo"
}
Upvotes: 2
Views: 1624
Reputation: 23767
How can I select only specific field or use aggregate command there?
To select only specific field, please refer to below command in mongo shell on portal:
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})
Test:
As for the aggregation function,cosmos db mongo api only supports partial of the all mongo aggregation functions,please refer to this document to check the supported features.
Upvotes: 2