For the complete documentation index, see llms.txt. This page is also available as Markdown.

Database

We use enmap to connect to your mongo database as it is fast and easy to use. Because of deprecation we use enmap 3 and enmap-mongo.

All commands can be found here: https://enmap.evie.dev/v/3/

You can access the database through the module (1) or on startup in the constructor (2)

// 1
const database = require("js-spring").database;

// 2
const { database } new SpringJS({ name: "test" });

We recommend for multiple files by starting up in a main file and accessing the database using the first method

Example usage

const SpringJS = require("js-spring");
const { database } new SpringJS({ name: "test" });

database.set("DanCodes", "Spring.js");

console.log("DanCodes wrote " + database.get("DanCodes") + "!");

Last updated

Was this helpful?