Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions modules/ROOT/pages/deprecations.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ The following products and applications are deprecated:
== GRANDstack starter app

The main purpose of the GRANDstack starter app was to demonstrate how the Neo4j Labs GraphQL library could be used in the context of a full-stack application using React and Apollo client.
It allowed developers to build applications more quickly and with a bigger focus on functionality, while also helping users who already had an existing front end and needed a new back end.
It allowed developers to build applications more quickly and with a bigger focus on functionality, while also helping users who already had an existing frontend and needed a new back end.

Over time, the GRANDstack starter app grew to support other frameworks such as Flutter and Angular, thus the need to revisit its scope.
The intention is to replace this project with a new starter application product, which will focus on the back end and the configuration of the GraphQL library, as well as help developers with their front end.
The intention is to replace this project with a new starter application product, which will focus on the back end and the configuration of the GraphQL library, as well as help developers with their frontend.

In the meantime, the `create-grandstack-app` npm package has been marked as deprecated.
It can still be used to skeleton a GRANDstack app, but the user will be warned that the package is deprecated.
Expand Down
8 changes: 4 additions & 4 deletions modules/ROOT/pages/index.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@

The Neo4j GraphQL Library is a highly flexible, low-code, open source JavaScript library that enables rapid API development for cross-platform and mobile applications by tapping into the power of connected data.

With Neo4j as the graph database, the GraphQL Library makes it simple for applications to have data treated as a graph natively from the front end all the way to storage.
This avoids duplicate schema work and ensures flawless integration between front-end and back-end developers.
With Neo4j as the graph database, the GraphQL Library makes it simple for applications to have data treated as a graph natively from the frontend all the way to storage.
This avoids duplicate schema work and ensures flawless integration between frontend and backend developers.

*If you are new to Neo4j and GraphQL*, take the course https://graphacademy.neo4j.com/courses/graphql-basics/?ref=docs[Introduction to Neo4j & GraphQL] in GraphAcademy to learn the fundamentals, how to use the xref:getting-started/toolbox.adoc[Neo4j GraphQL Toolbox] and the Neo4j GraphQL Library to create GraphQL APIs backed by a Neo4j graph database.

Expand Down Expand Up @@ -36,8 +36,8 @@ For every query and mutation that is executed against this generated schema, the

== Interaction

In the xref::getting-started/index.adoc[Getting Started] guide, Apollo Server is used to host the GraphQL schema, so you can interact directly with your API with no front end.
In case you prefer to use front-end frameworks, these are some clients that interact with GraphQL APIs:
In the xref::getting-started/index.adoc[Getting Started] guide, Apollo Server is used to host the GraphQL schema, so you can interact directly with your API with no frontend.
In case you prefer to use frontend frameworks, these are some clients that interact with GraphQL APIs:

- https://reactjs.org/[React] - support through https://www.apollographql.com/docs/react/[Apollo Client]
- https://vuejs.org/[Vue.js] - support through https://apollo.vuejs.org/[Vue Apollo]
Expand Down
121 changes: 56 additions & 65 deletions modules/ROOT/pages/queries-aggregations/aggregations.adoc
Original file line number Diff line number Diff line change
@@ -1,78 +1,45 @@
[[queries-aggregations]]
[[aggregations]]
:description: This page describes aggregations supported by Neo4j GraphQL.
= Aggregations

Neo4j GraphQL supports aggregations on fields with type:
Based on the given <<queries-aggregations/index.adoc#examples-reference, type definitions>>, here is a list of fields that accept aggregations supported by Neo4j GraphQL:

1. `ID`- String
2. `String` - String
3. `Int` - Numerical
4. `Float` - Numerical
5. `BigInt` - Numerical
6. `DateTime`
7. `Time`
8. `LocalTime`
9. `LocalDateTime`
10. `Duration`

Numerical Fields will expose the following aggregation selections:

1. `min`
2. `max`
3. `average`
4. `sum`

String fields will expose:

1. `shortest`
2. `longest`

The rest will only expose:

1. `min`
2. `max`


Aggregation queries accepts a `where` argument for xref::queries-aggregations/filtering.adoc[filtering] data.

== Counting Using aggregation

The following Query will count all User nodes:
[cols="1,1,2"]
|===
| Type | Aggregating function | Example

| String (e.g. `ID`, `String`)
| `shortest`, `longest`
a|
.Longest User name
[source, graphql, indent=0]
----
query {
usersAggregate {
count
}
}
----

== Counting User nodes where name starts with "J"

[source, graphql, indent=0]
----
query {
usersAggregate(where: { name_STARTS_WITH: "J" }) {
count
name {
longest
}
}
}
----

== Querying for the longest User name

| Numeric (e.g. `Int`, `Float`, `BigInt`)
| `min`, `max`, `average`, `sum`
a|
.Example query
[source, graphql, indent=0]
----
query {
usersAggregate {
name {
longest
}

}
}
----

== Querying for first Post date
----

| Temporal (e.g. `DateTime`, `Time`, `LocalTime`, `LocalDateTime`, `Duration`)
| `min`, `max`
a|
.First Post date
[source, graphql, indent=0]
----
query {
Expand All @@ -83,17 +50,41 @@ query {
}
}
----
|===

[NOTE]
====
The argument `where` can also be used in aggregation queries for xref::queries-aggregations/filtering.adoc[filtering] data.
====

[[queries-aggregate-related-nodes]]
== Aggregate related nodes

Related nodes can also be aggregated within a query by accessing the aggregation fields in the node.
In these fields, you can **count**, aggregate the **nodes** or **edges** fields.

The same selections and types as before are available in relationship aggregations.

=== Counting all posts per users
.Counting User nodes
[source, graphql, indent=0]
----
query {
usersAggregate {
count
}
}
----

.Counting User nodes where name starts with "J"
[source, graphql, indent=0]
----
query {
usersAggregate(where: { name_STARTS_WITH: "J" }) {
count
}
}
----

.Counting all posts per User
[source, graphql, indent=0]
----
query {
Expand All @@ -106,9 +97,9 @@ query {
}
----

=== Finding longest post per user
By using the `node` field, related nodes properties can be aggregated.
By using the `node` field, related nodes properties can be aggregated:

.Finding longest post per User
[source, graphql, indent=0]
----
query {
Expand All @@ -125,9 +116,11 @@ query {
}
----

=== Aggregate relationships
Relationship properties can be aggregated as well by using the `edge` field.
== Aggregate relationships

Relationship properties can be aggregated as well by using the `edge` field:

.Querying what User nodes posted up to a date
[source, graphql, indent=0]
----
query {
Expand All @@ -144,10 +137,8 @@ query {
}
----

=== Undirected aggregation queries

When performing an aggregation on related nodes, the query against the relationship
can be defined as an xref::queries-aggregations/queries.adoc#_undirected_queries[undirected] using the argument `directed: false`:
can be defined as "undirected" by using the argument `directed: false`:

[source, graphql, indent=0]
----
Expand Down
Loading