samuk190 / localbase

A Firebase-Style Database ... Offline!
636 stars 84 forks source link

Where #79

Closed carlosasjr closed 2 months ago

carlosasjr commented 1 year ago

Is possible create this code?

const products = await db.collection(${ RESOURCE }) .where("company_id", "==", company_id) .where("inactive", "==", 0) .orderBy("description") .get();

samuk190 commented 3 months ago

I've added filtering collection support, can you check if it works for your use case?

Mashiane commented 2 months ago

Hi, can you please provide an example of how to use this where filter?

Thanks

samuk190 commented 2 months ago

Try this :)

Hi, can you please provide an example of how to use this where filter?

Thanks

db.collection('users') .doc({id: 1}).get().then(user => { const u = user db.collection('orders') .get({keys: false, filter: {userId: u.id}}).then(orders => { u.orders = orders console.log(u) }) })