The FlexVertex Node.js Driver enables seamless interaction with the FlexVertex Data Multiverse, providing a multi-model, object-oriented approach to data management and query execution.
Before installing the FlexVertex Node.js driver, ensure that you have Node.js installed. You can download and install it from the official website:
https://nodejs.org
We recommend using the LTS version for the best stability.
Once Node.js is installed, install the FlexVertex Node.js driver via npm:
npm install @flexvertex/flexvertex-driver
To include the FlexVertex Node.js driver as a dependency in a project, you should install it using npm by running:
npm install flexvertex
Alternatively, you can add it directly to your package.json
by specifying it under "dependencies"
and running npm install
to fetch the package. If using a package manager like Yarn or pnpm, you can substitute npm install
with yarn add flexvertex
or pnpm add flexvertex
.
The FlexVertex
class initializes the driver.
Methods:
Syntax: .initialize()
Purpose: This method initializes the FlexVertex environment.
Usage:
let fv = FlexVertex.initialize();
View FlexVertex Node.js Initialize Driver Example on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexVertex-Initialize
A FlexSession represents a live, authenticated connection to a FlexVertex instance. It encapsulates the context needed to interact with the Data Multiverse, including access to the current user’s domain, nexus, and schema.
Methods:
.openSession(config)
let session = fv.openSession({
hostname: 'your-host',
username: 'your-email@example.com',
password: 'your-password'
});
The optional timeout
property specifies how many milliseconds the driver will wait before timing out.Syntax: .openSchema()
Purpose: This method opens the default schema.
Usage:
let schema = session.openSchema();
View FlexVertex Node.js FlexSession Open a Session and Schema Example on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexSession
FlexVertex is constructed around objects. This class provides important methods for creating, loading, querying, and deleting them. It's also where you'll be able to launch Voyager scripts and process their results.
Methods:
FlexObject(schema, className);
let obj = new FlexObject(schema, "Person");
Syntax: loadObject(objectKey)
;
Purpose: This method loads an object with the user-supplied key.
Usage:
let obj = await schema.loadObject(objKey);
View FlexVertex Node.js FlexSchema Create and Load Object Example on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexSchema-CreateAndLoadObject
deleteObject(object)
;await schema.deleteObject(obj1);
Syntax: deleteObjectByKey(object.objectKey)
;
Purpose: This method deletes an existing object using its key to locate it.
Usage:
await schema.deleteObject(obj1.objectKey);
View FlexVertex Node.js FlexSchema Delete Objects Example on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexSchema-DeleteObjects
Syntax: query(sql, parameters)
;
Purpose: Executes an SQL-like query with optional parameters.
Usage:
const rs = await schema.query("SELECT * FROM Person WHERE Name = @name", { name: 'Emily' });
View FlexVertex Node.js FlexSchema Query Example on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexSchema-Query
Syntax: executeVoyage(voyageScript, parameters)
;
Purpose: Runs an inlined Voyager script including optional parameters.
Usage:
let cargo = await schema.executeVoyage("Voyage { journey('select * from Person') }");
View FlexVertex Node.js FlexSchema Execute Voyage Example on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexSchema-ExecuteVoyage
Syntax: executeVoyagerAsset(path, parameters)
;
Purpose: Runs a hosted Voyager script including optional parameters.
Usage:
let cargo = await schema.executeVoyagerAsset('Home/Training classes/Introduction to FlexVertex/Querying Data/Voyager/Where has Marco visited.voyage');
View FlexVertex Node.js FlexSchema Execute Voyager Asset Example on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexSchema-ExecuteVoyagerAsset
Syntax: executeVoyagerFile(path, parameters)
;
Purpose: Runs a local Voyager script including optional parameters.
Usage:
let cargo = await schema.executeVoyagerAsset('./test.voyage');
View FlexVertex Node.js FlexSchema Execute Voyager File Example on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexSchema-ExecuteVoyagerFile
This class supplies a series of methods meant for creating objects, interacting with their properties, and connecting them.
Methods:
setProperty(name, value)
;obj.setProperty("Name", "Emily");
getProperty(name)
;let address = obj.getProperty("Address");
Syntax: save()
;
Purpose: Persists the object in the database.
Usage:
await obj.save();
View FlexVertex Node.js FlexObject Set and Get Properties Example on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexObject-SetAndGetProperties
connectTo(targetObject, options)
;obj1.connectTo(obj2);
Syntax: connectFrom(sourceObject, options)
;
Purpose: Establishes a connection from another object, including optional settings
Usage:
obj1.connectFrom(obj2);
View FlexVertex Node.js FlexObject Connect To and From Example on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexObject-ConnectToAndFrom
FlexVertex uses connections to establish and search relationships among objects. Connections are established with FlexObject methods, while these methods are designed for setting and retrieving connection properties, as well as various ways to delete them.
Methods:
setProperty(name, value)
;connection.setProperty("Name", "Emily");
getProperty(name)
;let address = connection.getProperty("Address");
Syntax: save()
;
Purpose: Saves a connection.
Usage:
await connection.save();
View FlexVertex Node.js FlexConnection Set and Get Properties Example on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexConnection-SetAndGetProperties
delete()
;await schema.deleteConnection(connection);
Syntax: deleteConnectionByKey()
;
Purpose: Deletes a connection using its key.
Usage:
await schema.deleteConnection(connection.objKey);
View FlexVertex Node.js FlexConnection Delete Connections Example on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexConnection-DeleteConnections
After you issue a SQL-like query, FlexVertex responds with a result set. You'll use this class to interact with those results.
Methods:
Syntax: resultset.objects
;
Purpose: Retrieves all objects in the result set.
Usage:
for (let obj of result.objects) {
console.log(obj.getProperty("Name"));
}
View FlexVertex Node.js FlexResultSet View Result Set Objects on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexResultSet-Objects
Cargo is a dynamic data container used during Voyager script execution, allowing both input and output of complex, user-defined datasets. Each voyage has an associated FlexCargo instance whose returned property holds the result—typically a FlexJourney, FlexResultSet, or any supported object from the Java API.
Methods:
hasJourney()
;cargo.hasJourney();
Syntax: hasResultSet()
;
Purpose: Determine if a cargo contains a result set.
Usage:
cargo.hasResultSet();
View FlexVertex Node.js FlexCargo Check Results on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexCargo-CheckResults
Journeys are composed of segments. This class is used to identify the segment's source, connection, and target.
Methods:
.source()
;let source = segment.source();
.connection()
;let connection = segment.connection();
Syntax: .target()
;
Purpose: Retrieves the target object.
Usage:
let target = segment.target();
View FlexVertex Node.js FlexSegment View Journey Segments on GitLab
https://gitlab.flexvertex.com/OpenSource/FVDM/Examples/Node.js/FlexSegment-ViewSegments