Hacker News new | ask | show | jobs
by HodGreeley 3181 days ago
Curious how this compares to Couchbase + N1QL, since that gets you a document db that also supports full SQL.
1 comments

In our case, we wanted something more compact, so a query looks more like GraphQL (it's technically a superset of JSON, but it usually doesn't look like JSON). Joins, for example, are just nested declarations that list which attributes on the joined collections to fetch. Here's a query that shows many of the features:

    *[_type == "blogpost" && published == true] {
      _id, title,

      "bodyExcerpt": regexReplace(body, "(.+?)(\. |$)", "\\1"),
      
      author -> { name, category },

      "sectionNames": sections -> name
    } | order(createdAt desc)[0..20]
I don't know much about N1QL, I will have to read more about it.