Star

Created With

linkTemp DBs

You can work with temporary dbs (which can be cleared all at once) by using the static fromTempDatabase to initialize your Neogma instance. You pass in all the same props as in the constructor except the name of the database, as it will be created for you and managed internally by Neogma.

1link/* --> create a neogma instance that is latched onto an internally managed temp database */

2linkconst neogma = Neogma.fromTempDatabase(

3link {

4link /* --> use your connection details */

5link url: 'bolt://localhost',

6link username: 'neo4j',

7link password: 'password',

8link },

9link {

10link logger: console.log,

11link }

12link);

To dispose of a temp databse when you're done using it, you can use one of the following three methods:

1linkconst database = neogma.database;

2linkawait neogma.clearTempDatabase(database);

As shown above this method requires you to pass the exact name of the database to dispose of. Sometimes that may not be what's needed if working with a large number of temp dbs so you could get them all at once.

1linkawait neogma.clearAllTempDatabases();

You could also specify the time frame (of creation) in seconds to delete the dbs that are older than it.

1linkconst seconds = 1000;

2linkawait neogma.clearTempDatabasesOlderThan(seconds);

Temp DBs

Introduction Getting Started

Modelschevron_right

Sessions and Transactions

Query Builderchevron_right
Query Runnerchevron_right

Bind Parameters

Where Parameters