Configure the Cypher default versionIntroduced in 2025.06
You can specify the version of Cypher® in which you want to run your queries, choosing between Cypher 5 and Cypher 25. Cypher 5 is the default version for all newly created databases, however, if you want to take advantage of the new features in Cypher 25, you can set the default version to Cypher 25. For more information, see Cypher® versions.
To specify the Cypher version, use one of the following options:
- Configure a default Cypher version for the whole DBMS
-
The default language version for the whole DBMS can be configured in the neo4j.conf file using the setting db.query.default_language (default value: CYPHER_5).
Changing this setting in an existing DBMS does not affect existing databases. It only applies to newly created databases unless the version is specified as part of theCREATEorALTERdatabase commands. - Configure a default Cypher version per database
-
The default language for a specific database can be set using a Cypher database administration command with the
SET DEFAULT LANGUAGEclause when creating the database or by altering the database after it has been created. This clause determines the default Cypher version for the specified database, overriding the version set in the configuration file. For example,CREATE DATABASE mydb SET DEFAULT LANGUAGE CYPHER 25orALTER DATABASE mydb SET DEFAULT LANGUAGE CYPHER 5. For more details and examples, see Database management command syntax and the respective pages in the Database administration section.
If not specified, the default language for the database is set to the default language of the DBMS. Setting the default language on creation only require the correctCREATEprivilege. Modifying the default language for an existing standard database requires theSET DATABASE DEFAULT LANGUAGEprivilege and for an existing composite database theALTER COMPOSITE DATABASEprivilege.Setting the default language to
CYPHER 25ensures that all queries run on that database will use the version ofCypher 25that the database is currently running (unless you prepend your queries withCYPHER 5, which overrides this default). For example, a Neo4j 2025.08 database with default languageCypher 25will useCypher 25as it exists in Neo4j 2025.08, including any changes introduced in Neo4j 2025.06, 2025.07, and 2025.08.Setting the default language to
CYPHER 5ensures that all queries run on that database will use the version ofCypher 5as it existed at the time of the Neo4j 2025.06 release (unless you prepend your queries withCYPHER 25, which overrides this default). Any changes introduced after the 2025.06 release will not affect the semantics of the query. - Set the Cypher version on a per-query basis
-
The default language for a specific query can be set by prepending the query with the
CYPHER 5orCYPHER 25keyword.
For example,CYPHER 25 MATCH (n) RETURN norCYPHER 5 MATCH (n) RETURN n. This setting determines the language for the specified query, overriding the default language set in the configuration file and the database.