/// <summary> /// Fill terms from where predicate list /// </summary> private void SplitWherePredicateInTerms() { void add(BsonExpression predicate) { // do not accept source * in WHERE if (predicate.UseSource) { throw new LiteException(0, $"WHERE filter can not use `*` expression in `{predicate.Source}"); } // add expression in where list breaking AND statments if (predicate.IsPredicate || predicate.Type == BsonExpressionType.Or) { _terms.Add(predicate); } else if (predicate.Type == BsonExpressionType.And) { var left = predicate.Left; var right = predicate.Right; add(left); add(right); } else { throw LiteException.InvalidExpressionTypePredicate(predicate); } } // check all where predicate for AND operators foreach (var predicate in _query.Where) { add(predicate); } }