0
votes

I have a documentDb instance which I can query using the azure portal tools: enter image description here

When I write the same query in code like this:

let valuationCollection = client.CreateDocumentCollectionQuery(database.CollectionsLink).Where(fun dc -> dc.Id = "taxinformation").ToArray().FirstOrDefault()
let valuationDocumentLink = valuationCollection.SelfLink
let valuationQueryString = "SELECT * FROM ti WHERE ti.index = 1"
let valuationQuery = client.CreateDocumentQuery(valuationQueryString,valuationQueryString)
let valuationValue = valuationQuery |> Seq.head
let valuation = HouseValuation.Parse(valuationValue.ToString())

I am getting this error:

System.AggregateException: One or more errors occurred. ---> Microsoft.Azure.Documents.NotFoundException: The value 'SELECT * FROM TI WHERE TI.INDEX = 1' specified for query '$resolveFor' is invalid. at Microsoft.Azure.Documents.BackoffRetryUtility`1.d__0.MoveNext()

I have other queries that work fine. I am wondering if "index" should not be used?

Thanks in advance

2

2 Answers

1
votes

No, index is not reserved. You should be able to use this.

0
votes

The problem was with the code itself on line 4 above:

let valuationQuery = client.CreateDocumentQuery(valuationQueryString,valuationQueryString)

should be

let valuationQuery = client.CreateDocumentQuery(valuationDocumentLink,valuationQueryString)