A familiar language for your ideas
Query Examples
Find a pattern. Copy the code. Make it your own.
BsonLite query examples for your next BsonLite app.
Insert a document
const users = BsonLite.collection('users');
const result = await users.insertOne({
name: 'Alex',
role: 'maker',
active: true,
joinedAt: new Date()
});
console.log(result.insertedId);Illustrative sample outputExample
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 BsonLite and appropriate sample collections. Supported operations follow your BsonLite engine profile.