diff --git a/.changeset/purple-crews-pretend.md b/.changeset/purple-crews-pretend.md deleted file mode 100644 index 327e9f91..00000000 --- a/.changeset/purple-crews-pretend.md +++ /dev/null @@ -1,27 +0,0 @@ ---- -"@neo4j/cypher-builder": minor ---- - -Add support for Collect subqueries: - -```js -const dog = new Cypher.Node({ labels: ["Dog"] }); -const person = new Cypher.Node({ labels: ["Person"] }); - -const subquery = new Cypher.Match( - new Cypher.Pattern(person).related(new Cypher.Relationship({ type: "HAS_DOG" })).to(dog) -).return(dog.property("name")); - -const match = new Cypher.Match(person) - .where(Cypher.in(new Cypher.Literal("Ozzy"), new Cypher.Collect(subquery))) - .return(person); -``` - -```cypher -MATCH (this0:Person) -WHERE "Ozzy" IN COLLECT { - MATCH (this0:Person)-[this1:HAS_DOG]->(this2:Dog) - RETURN this2.name -} -RETURN this0 -``` diff --git a/CHANGELOG.md b/CHANGELOG.md index 24fc7dc8..59b95628 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,35 @@ # @neo4j/cypher-builder +## 1.13.0 + +### Minor Changes + +- [#301](https://github.com/neo4j/cypher-builder/pull/301) [`f2f679b`](https://github.com/neo4j/cypher-builder/commit/f2f679bc6256ffb20feeb9146221e06b8bf06247) Thanks [@angrykoala](https://github.com/angrykoala)! - Add support for Collect subqueries: + + ```js + const dog = new Cypher.Node({ labels: ["Dog"] }); + const person = new Cypher.Node({ labels: ["Person"] }); + + const subquery = new Cypher.Match( + new Cypher.Pattern(person) + .related(new Cypher.Relationship({ type: "HAS_DOG" })) + .to(dog), + ).return(dog.property("name")); + + const match = new Cypher.Match(person) + .where(Cypher.in(new Cypher.Literal("Ozzy"), new Cypher.Collect(subquery))) + .return(person); + ``` + + ```cypher + MATCH (this0:Person) + WHERE "Ozzy" IN COLLECT { + MATCH (this0:Person)-[this1:HAS_DOG]->(this2:Dog) + RETURN this2.name + } + RETURN this0 + ``` + ## 1.12.0 ### Minor Changes diff --git a/package.json b/package.json index 49f8c5cb..43909c3f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@neo4j/cypher-builder", - "version": "1.12.0", + "version": "1.13.0", "description": "A programmatic API for building Cypher queries for Neo4j", "exports": "./dist/index.js", "main": "./dist/index.js",