SaltechSystems / couchbase_lite

Flutter plugin for the Community edition of Couchbase Lite. Couchbase Lite is an embedded lightweight, document-oriented (NoSQL), syncable database engine.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

And Query is not working returning empty result.

richard457 opened this issue · 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.

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),
                ),
              )
}