Alpha75
Alpha75

Reputation: 2280

Get all fields from a DocumentDB joined query

I have a DocumentDB database in Azure which I access through the CosmosDB API.

I'd like to get all the parent fields of a document with a simple query:

SELECT p.id 
    FROM parent p JOIN ch IN p.property1.child
    WHERE CONTAINS(UPPER(ch.name), UPPER(@childName))

This query works but I get only the 'id' property. I can't use p.* (a syntax error is throwed) and probably the list will change in the future. With * I get this error: 'SELECT *' is only valid with a single input set.

It's there a way to get the whole json of parent document without the need to write the complete list of fields on the select clause?

Upvotes: 6

Views: 1437

Answers (1)

Aravind Krishna R.
Aravind Krishna R.

Reputation: 8003

You can instead use SELECT VALUE p FROM p JOIN ch .... This is equivalent to p.*

Upvotes: 10

Related Questions