I have the following function which is fetching whole documents :
public async Task<IEnumerable<dynamic>> GetAllPreferences(string queryString)
{
IDocumentQuery<dynamic> query = documentClient.CreateDocumentQuery<dynamic>(
UriFactory.CreateDocumentCollectionUri(collectionInfo.DatabaseName, collectionInfo.CollectionName))
.AsDocumentQuery();
List<dynamic> results = new List<dynamic>();
while (query.HasMoreResults)
{
results.AddRange(await query.ExecuteNextAsync<dynamic>());
}
return results;
}
But here I am not able to make use of queryString. I have the following structure of my document :
{
"type": [
"university",
"institute"
],
"preferences": [
{
"type": "university",
"universityDetail": [
.....
],
"state" : [
....
]
},
{
"type": "institute",
"instituteDetail": [
.....
],
"state" : [
....
]
}
]
}
I have to get only preferences from each document. The equivalent sql query is "select preferences from collectionInfo.CollectionName".
Please suggest the code edit and also help me with the exact queryString required in my case.
Thanks a lot in Advance.