Example #1
0
 public static void _updateEmployee(MongoDatabase db)
 {
     if (db.CollectionExists("employee"))
     {
         MongoCollection <BsonDocument> values = db.GetCollection("employee");
         BsonDocument bs = values.FindOne();
         bs.Set("name", BsonValue.Create("Emp100"));
         bs.Set("email", BsonValue.Create("*****@*****.**"));
         values.Save(bs);
     }
 }
Example #2
0
        public static void _updateEmployeeObject(MongoDatabase db)
        {
            if (db.CollectionExists("employee"))
            {
                MongoCollection <Employee> values = db.GetCollection <Employee>("employee");
                Employee emp = values.FindOne();
                emp.Name = "Emp1000";

                values.Save(emp);
            }
        }
Example #3
0
 /// <summary>
 ///   Finds the one.
 /// </summary>
 /// <param name = "spec">The spec.</param>
 /// <returns></returns>
 public Document FindOne(Document spec)
 {
     return(_collection.FindOne(spec));
 }