Installation
What This Page Covers
This page covers the path from installing monSQLize to validating a minimal MongoDB-backed collection:
- Installation
- Initializing
MonSQLize connect()collection()- Basic writes and queries
- Closing the connection
- Where to continue with basic usage
Installation
Requirements
- Node.js 18 or newer.
- A MongoDB URI, such as
mongodb://localhost:27017. - Optional Redis, SSH tunnel, cache, Model, and sync features are configured only when your application uses them.
Minimal Connection Example
Runnable Example in This Repository
If you are validating the minimal path inside this repository, run:
The current official example is examples/quick-start/basic-connect.ts. During verification, it is compiled before it runs. The example:
- Starts an in-memory MongoDB instance.
- Creates and connects a
MonSQLizeinstance. - Inserts one user document.
- Reads the document back and prints the result.
- Closes the connection and cleans up the temporary database.
Next Steps
- Continue with common CRUD, pagination, cache, and Model entry points in
basic-operations.md. - Review all constructor options in
configuration.md. - Learn query details in
find.md,findOne.md, andfindPage.md. - Compare runnable examples in
examples.md. - Open the source examples on GitHub:
Common Notes
- Calling
collection()beforeconnect()triggersNOT_CONNECTED. - Missing
config.uritriggersINVALID_CONFIG. - Application code should import from the package root:
import MonSQLize from 'monsqlize'orconst MonSQLize = require('monsqlize').