Answers for "mongodb insert"

4

mongodb insertone

db.<yourcollection>.insertOne({name :"<yourvalue>", firstname :"<yourvalue>"})
Posted by: Guest on February-18-2021
5

mongodb insert

db.products.insert( { item: "card", qty: 15 } )
Posted by: Guest on June-07-2020
5

insert command mongo

db.collection.insert( { item: "card", qty: 15 } )
Posted by: Guest on August-14-2020
0

Mongo Insert

using MongoDB.Driver;
using MongoDB.Bson;

namespace InsertDocument
{
    class Program
    {
        static void Main(string[] args)
        {
            var dbClient = new MongoClient("mongodb://127.0.0.1:27017");

            IMongoDatabase db = dbClient.GetDatabase("testdb");

            var cars = db.GetCollection<BsonDocument>("cars");

            var doc = new BsonDocument
            {
                {"name", "BMW"},
                {"price", 34621}
            };

            cars.InsertOne(doc);
        }
    }
}
Posted by: Guest on October-13-2021

Browse Popular Code Answers by Language