Insert Documents

FerretDB accepts standard MongoDB insert operations. Uses the MongoDB Node.js driver — no FerretDB-specific code needed.

Syntax

ferretdb
collection.insertOne(doc)
collection.insertMany([docs])

Example

ferretdb
import { MongoClient } from 'mongodb';
const client = new MongoClient('mongodb://localhost:27017');
const col = client.db('myapp').collection('users');

await col.insertOne({
  name: 'Alice',
  email: 'alice@example.com',
  createdAt: new Date(),
});