couchbase_lite icon indicating copy to clipboard operation
couchbase_lite copied to clipboard

And Query is not working returning empty result.

Open richard457 opened this issue 3 years ago • 1 comments

Describe the bug When I do Query like select * from document where sth =sth and sth = sth it does not work

To Reproduce

Future<List<Map<String, dynamic>>> filter(
QueryBuilder.select([SelectResult.all()])
        .from(CoreDB.instance.dbName)
        .where(
          Expression.property(property)
              .equalTo(
                Expression.string(equator),
              )
              .and(
                Expression.property(andProperty).equalTo(
                  Expression.string(andEquator),
                ),
              )
}

Expected behavior I expect that if I have a document that has for example table='users' name='richard murag' id=WDF to be returned by that Query This is How I would call it final ``` List<Map<String, dynamic>> product = await _databaseService.filter( equator: 'richard murag', property: 'name', and: true, andProperty: 'table', andEquator: 'users, );


 - OS: [android 29 sdk]

 - Version [couchbase_lite: ^2.7.1+6]

I need your help on this.

richard457 avatar Nov 11 '20 22:11 richard457

Try adding from(CoreDB.instance.dbName) to all the expressions.

Future<List<Map<String, dynamic>>> filter(
QueryBuilder.select([SelectResult.all()])
        .from(CoreDB.instance.dbName)
        .where(
          Expression.property(property).from(CoreDB.instance.dbName)
              .equalTo(
                Expression.string(equator),
              )
              .and(
                Expression.property(andProperty).from(CoreDB.instance.dbName).equalTo(
                  Expression.string(andEquator),
                ),
              )
}

bawelter avatar Dec 05 '20 23:12 bawelter