MongoDB C# docs
GitHub.NET DriverMongoDB docs
  • ⭐Introduction
  • πŸ“ŒGetting started
    • Environment setup
    • πŸƒβ€β™‚οΈ Quick start
      • MongoDB connection
      • Databases
      • Collections
      • Insert documents
      • Read documents
      • Update documents
  • πŸ“‘CRUD Basics
    • βž•Create
      • Id Member
      • Ordered insert
    • πŸ”ŽRead
      • Basics
      • Comparison Operators
      • Logical Operators
      • Element Operators
      • Array operators
      • Evaluation Operators
    • πŸ“Update
      • Operators
      • Replace
      • Arrays
    • ❌Delete
  • πŸ§ͺAggregation
    • Overview
    • βœ‚οΈProject
    • 🎯Match
    • πŸ“¦Group
    • 🚩Unwind
    • ⏩Pagination
    • πŸ“ˆBucket
    • ✨Operators
Powered by GitBook
On this page
  • New documents
  • Configuration
  • Ordered Insert
  1. CRUD Basics

Create

PreviousUpdate documentsNextId Member

Last updated 5 years ago

New documents

Inserting new documents is quite easy as explained in the Quick Start section. You can use the InsertOne and InsertMany methods to add one or multiple documents respectively. Other than the basics, it's certain you will face some more advanced scenarios, such as inserting nested documents or pushing items to nested array fields. You might think this is an insert operation but for MongoDB are considered update operations and they will be described on the related sections.

Configuration

Each top level document in MongoDB contains an _id field which is either passed as an argument during insertion either automatically created. This field can be generated and deserialized back to a C# model class based on a related configuration which the r page covers thoroughly.

Ordered Insert

Another concept covered in this section is the , which explains how MongoDB behaves when facing unique ids conflicts during multiple documents insertions.

πŸ“‘
βž•
πŸ†•
πŸ› οΈ
Insert Documents
Id Membe
Ordered Insert
Create documents