Cannot get expression with "IN" operator to work in .Net Lite query

I have a data structure where I need to get the result of a query like this (in N1QL):

WHERE type='ObservationType' AND "2" in locationtypes

In .Net lite I have this code:

if (!string.IsNullOrEmpty(locationType))
       _condition = _condition.And(Expression.String(locationType).In(Expression.Property("locationtypes")));

… but I get a: System.NotSupportedException has been thrown. I tried with this as well:

       _condition = _condition.And(Expression.String(locationType).In(Expression.Value(Expression.Property("locationtypes"))));

Same error :frowning:

How can I make the query understand that I want to use the “locationtypes” property?

This is a sample output from the N1QL query:

      "locationtypes": [

… or:

      "locationtypes": [
  let searchQuery = QueryBuilder
                .and( ArrayFunction.contains("locationtypes"), value:

Ok, so I can’t use the “in” operator :slight_smile:

For some reason code like the above does not seem to return the data I expect. Looking in the debugger the _condition is set to:

{[QueryCompoundExpression] => ["AND",["=",[".type"],"ObservationType"],["ARRAY_CONTAINS()",[".locationtypes"],"2"]]}

And if I understand the notation then that should be correct? So I guess I need to verify that the sync is working the way I expect it and the field with values (set from the server) really are in the local db :wink:


Ahhh… - and YES, an update of the data in that database instance wasn’t updated :blush:

It works like a charm :+1::pray:

1 Like