|
|
|
|
|
by lobster_johnson
3181 days ago
|
|
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. |
|