Hacker News new | ask | show | jobs
by lucideer 1463 days ago
I mean if it's brevity you're after, the first example can be rewritten in a terser style:

    const userSnapshots = await Promise.all(
        getDocs(collection(db, "messages")).then(
            docs => docs().map(snapshot => getDoc(snapshot).data().creator)
        )
    )
Ultimately you're kinda just comparing preference for SQL syntax over JS in that case.

The JS example is also async (always adds visual complexity to code calls), whereas the PHP example is blocking. That SQL query doesn't look particularly efficient either...

There's plenty of good solid criticisms of Firebase & NoSQL but these aren't it. e.g. your HTTP roundtrip argument has been debunked by sibling commenters, but client-side DB calls is still riddled with adjacent problems & ultimately adding more complexity to the server-side avoid the need for client-side DB access is often worthwhile.