Back
Syntax
Study
Editor
Mode:
HTML
CSS
JavaScript
PHP
Reset
Run »
HTML / CSS / JS
// BSON type examples in mongosh db.typesDemo.insertOne({ // String name: "Alice", // 32-bit integer age: NumberInt(30), // 64-bit integer fileSize: NumberLong("9007199254740993"), // Double (default for JS numbers) price: 19.99, // High-precision decimal balance: NumberDecimal("12345.6789"), // Date createdAt: new Date(), // Boolean isActive: true, // Null deletedAt: null, // Array tags: ["nodejs", "mongodb"], // Embedded document address: { city: "London", country: "UK" }, // Binary data avatar: BinData(0, "base64encodedstring=="), // ObjectId reference authorId: ObjectId("64a1f2b3c4d5e6f7a8b9c0d1") })
Result
Open