Reputation: 9881
I will be receiving flat documents that will have slightly different schemas.
For example:
{
"FirstName": "Jim",
"LastName: "Bob"
}
And another one, that would simply have:
{
"FullName": "Jim Bob"
}
Is it possible to query the Person
collection to retrieve the list of unique properties (not the values)?
[
"FirstName",
"LastName",
"FullName"
]
Upvotes: 1
Views: 397
Reputation: 23782
According to my research, it is not supported in cosmos db query syntax so far. You could refer to this similar feedback and adopt the suggestions from cosmos db team.
Also, I think you could get all the names of properties by below coding workaround.
Create and init a hashmap.
Query the documents and get the results array.
Loop the array and convert every json to map.
Push the elements into initial hashmap to make sure the list of properties is unique.
Upvotes: 1