Example #1
0
        public void TestVariableWorksForUpdate()
        {
            int index = 10;

            IMongoUpdate update = Update <TestClass> .Set(x => x.List[index].Name, "Blah");

            Assert.Equal("{ \"$set\" : { \"List.10.Name\" : \"Blah\" } }", update.ToString());
        }
Example #2
0
 public override FindAndModifyResult FindAndModify(
     IMongoQuery query,
     IMongoSortBy sortBy,
     IMongoUpdate update,
     bool returnNew,
     bool upsert)
 {
     if (writer != null)
     {
         this.writer.WriteLine("FindAndModify Query:");
         this.writer.WriteLine(query == null ? "No Query" : query.ToString());
         this.writer.WriteLine("SortBy: " + (sortBy == null ? "Nothing" : sortBy.ToString()));
         this.writer.WriteLine("Update: " + (update == null ? "Nothing" : update.ToString()));
         this.writer.WriteLine();
         this.writer.Flush();
     }
     return(mCollection.FindAndModify(query, sortBy, update, returnNew, upsert));
 }