A familiar language for your ideas

Your query playground.

Find a pattern. Copy the code. Make it your own.
MongoDB 4.0-compatible examples for your next BsonLite app.

CRUD

Insert a document

javascript
const users = BsonLite.collection('users');

const result = await users.insertOne({
  name: 'Alex',
  role: 'maker',
  active: true,
  joinedAt: new Date()
});

console.log(result.insertedId);
Connect in Node.js first →

This is a documentation demo, not a browser database. Sample output is illustrative; it does not execute MongoDB or write your data.

Before you run a query

Import BsonLite.cjs and await BsonLite.connect() in your Node application. The snippets assume a connected SDK and appropriate sample collections. MongoDB 4.0 server compatibility applies.

Query operators · BSON types · Aggregation guide