Saving objects into CBL - getting wrong type for saved integers when querying

.net
n1ql

#1

We are saving several objects into CBL successfully, one of which has a property like so:

{“valueQuantity”: { “value”: “100”, “unit”: “”, “system”: “http://unitsofmeasure.org“, “code”: “{total}” }}

We can query against it, and get it back out successfully, but when querying for this property like so:

.Select(SelectResult.Expression(Function.Max(Expression.Property(“valueQuantity.value”)))), Max is returning the biggest string. e.g. We provide 6, 50, and 100, and 6 is the value returned.

Is there a way to better save the object so CBL has it typed correctly, or is there a way to combine the call to Max with an integer conversion?


#2

The value property’s value should be a number, not a string, then. In your example, remove the quotes from around 100.