Return sub-document attributes as top-level attributes in a Cosmos Sql Query

James Barnett 1 Reputation point
2021-04-06T19:10:40.997+00:00

I have a UDF that is reformulating a document and returning a new document. Working well,
but the resulting document is returned as an attribute of the result; whereas, I would like it to be the TOP level.

SELECT udf.reformatDoc(c) AS X FROM c
-- Returns
{"x": {"inner": "Stuff from inner doc"}}

-- But, I want

{"inner": "Stuff from inner doc"}

Is there anyway to accomplish this in the query?

Azure Cosmos DB
Azure Cosmos DB
An Azure NoSQL database service for app development.
1,454 questions
{count} votes