Adamite
  • Initial page
  • Server
    • Introduction
    • Database
      • Configuration
      • Using different adapters
        • Memory Adapter
      • Securing your data
        • Securing read operations
    • Functions
      • Invokable Functions
      • Runtime Functions
      • Scheduled Functions
  • SDK
    • Introduction
    • Database
      • Introduction
      • Read a document
      • Read multiple documents
      • Subscribe to changes
      • Create a new document
      • Update an existing document
      • Delete a document
    • Authentication
      • Create a user
      • Log in and log out
      • Get the logged in user
    • Functions
      • Invoke a function
Powered by GitBook
On this page

Was this helpful?

  1. SDK
  2. Database

Create a new document

First, reference the collection you'd like to insert a document into.

const projects = adamite().database().collection("projects");

Now, you can call create on the collection reference to insert a new document. The document (including it's automatically generated id) will be returned to you.

const newProject = await projects.create({
  name: "Test"
});
PreviousSubscribe to changesNextUpdate an existing document

Last updated 5 years ago

Was this helpful?