henriquecarv / loopback-connector-realtime-database

Firebase Realtime Database connector for the LoopBack framework.
MIT License
2 stars 4 forks source link

"or" and "and" operators do not works #216

Open Fr4nZ82 opened 4 years ago

Fr4nZ82 commented 4 years ago

Describe the bug

Do not know if is a feature request or a bug, but queries with filters like where: { and: [ { item: 'somestring' }, { deleted: false } ] } do not works.

error Error: Query: First argument passed to startAt(), endAt(), or equalTo() cannot be an object.
    at Function.Query.validateQueryEndpoints_ (C:\myproject\node_modules\@firebase\database\src\api\Query.ts:138:15)
    at Query.startAt (C:\myproject\node_modules\@firebase\database\src\api\Query.ts:509:11)
    at Query.equalTo (C:\myproject\node_modules\@firebase\database\src\api\Query.ts:574:17)
    at RealtimeDatabase.queryData (C:\myproject\node_modules\loopback-connector-realtime-database\lib\realtime-database.js:81:10)
    at RealtimeDatabase.all (C:\myproject\node_modules\loopback-connector-realtime-database\lib\realtime-database.js:57:33)
    at invokeConnectorMethod (C:\myproject\node_modules\loopback-datasource-juggler\lib\dao.js:172:21)
    at C:\myproject\node_modules\loopback-datasource-juggler\lib\dao.js:1730:7
    at doNotify (C:\myproject\node_modules\loopback-datasource-juggler\lib\observer.js:157:49)
    at doNotify (C:\myproject\node_modules\loopback-datasource-juggler\lib\observer.js:157:49)
    at Function.ObserverMixin._notifyBaseObservers (C:\myproject\node_modules\loopback-datasource-juggler\lib\observer.js:180:5)
    at Function.ObserverMixin.notifyObserversOf (C:\myproject\node_modules\loopback-datasource-juggler\lib\observer.js:155:8)
    at Function.ObserverMixin._notifyBaseObservers (C:\myproject\node_modules\loopback-datasource-juggler\lib\observer.js:178:15)
    at Function.ObserverMixin.notifyObserversOf (C:\myproject\node_modules\loopback-datasource-juggler\lib\observer.js:155:8)
    at Function.find (C:\myproject\node_modules\loopback-datasource-juggler\lib\dao.js:1728:10)
    at Function.findOne (C:\myproject\node_modules\loopback-datasource-juggler\lib\dao.js:1775:8)
    at UserRepository.findOne (C:\myproject\node_modules\@loopback\repository\src\repositories\legacy-juggler-bridge.ts:405:23)
    at UserController.register (C:\myproject\src\controllers\user.controller.ts:236:53)
henriquecarv commented 4 years ago

It hasn't been implemented in this connector yet.

I will try to look at it when I have some time, but feel free to attempt a solution for this. I am sure, a lot of people could also benefit from it.