Insert Documents
Mission
Insertions save schemaless JSON records into your virtual database namespaces.
The Payoff
By completing this module, you will understand how to insert documents containing rich nested attributes.
Estimated Time: 2 minutesModules: 1 Concepts
Select your namespace
Establish the collection reference (.collection('users')) where documents belong.
Build the payload dictionary
Define nested arrays and parameters matching your document structure.
Save and handle the response key
Extract the database-allocated ID (_id) from the returned response wrapper.
Interactive Code Snippet
typescript
const response = await sdk.collection("users").insert({ username: "coder_alex", email: "[email protected]", profile: { theme: "dark", notifications: true }, roles: ["admin"]});console.log("Created Document ID:", response._id);