Quick start
Open a SQLite file with MongoClient, write a document, and query it through the MongoDB-compatible API. This example runs on Node.js 24 or newer using built-in SQLite.
Run from source
Silt is preparing its first release; its packages are currently local npm workspaces.
Repository access is required while the repository is private. The example creates silt-guide.sqlite in your current directory. Run it again to check that the same file can be reused, or pass another filename:
Open a database
The collection calls use the familiar MongoDB API. Writes and cursor consumption return promises. client.db() returns the database handle immediately, and client.close() releases the owned connection.
One file is one database. Here, client.db() and client.db('app') are the same handle. A different database name is rejected; open another file for another database.
Verify persistence
The runnable example resets one demo document, queries it, updates it, and closes the client. A new client opening the same file reads the saved change:
Calling connect() explicitly is optional: the first database operation opens the connection if needed.
Choose your next step
- Use MongoDB code: change initialization and check the compatibility boundary.
- Local development and testing: persistent development files and isolated test fixtures.
- Deployment: Node, better-sqlite3, WAL, and worker configuration.
- Expo: embed the same API on web, iOS, and Android.
Use the official MongoDB docs for ordinary collection operations, and Silt's compatibility reference for supported methods and limitations.