JamesBarnett-0591 avatar image
0 Votes"
JamesBarnett-0591 asked AnuragSharma-MSFT commented

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

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?

· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @JamesBarnett-0591, welcome to Microsoft Q&A forum.

Would it be possible for you to share the UDF script along with couple of document scripts to run it with? That way we could look into exact result and work accordingly.

0 Votes 0 ·

0 Answers