Closed gryphonmyers closed 2 years ago
This is possible. Use filter('nestedObject/color', 'like', 'blue')
instead. I see I didn't document that. Note that the collection in your example is an array, not a collection. See this example code:
const { AceBase } = require("acebase")
const db = new AceBase('test');
await db.ref('books').push({ title: 'book 1', cover: { color: 'blue' } });
await db.ref('books').push({ title: 'book 2', cover: { color: 'red' } });
const snaps = await db.query('books').filter('cover/color', '==', 'blue');
snaps.forEach(snap => console.log(snap.val()));
After reading through the docs, it seems there may not be a way to filter on nested data. For example, let's say I have a collection of items that looks like:
Can I perform a query for only the first entry based on the fact that it has a
blue
nestedObject? Based on the docs that should look something like:But I don't think this works because the first argument of filter is described as a "key" not an object notation path. Is there something I'm missing or is this really not possible? Are there plans to support this type of query?