当前位置: 首页>>代码示例>>C#>>正文


C# MongoCollection.Drop方法代码示例

本文整理汇总了C#中MongoCollection.Drop方法的典型用法代码示例。如果您正苦于以下问题:C# MongoCollection.Drop方法的具体用法?C# MongoCollection.Drop怎么用?C# MongoCollection.Drop使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MongoCollection的用法示例。


在下文中一共展示了MongoCollection.Drop方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: TestFixtureSetup

 public void TestFixtureSetup()
 {
     server = MongoServer.Create("mongodb://localhost/?safe=true;slaveOk=true");
     database = server["onlinetests"];
     collection = database.GetCollection<C>("test");
     collection.Drop();
 }
开发者ID:djcsdy,项目名称:mongo-csharp-driver,代码行数:7,代码来源:CSharp355Tests.cs

示例2: TestFixtureSetup

 public void TestFixtureSetup()
 {
     _server = Configuration.TestServer;
     _database = Configuration.TestDatabase;
     _collection = Configuration.TestCollection;
     _collection.Drop();
 }
开发者ID:annikulin,项目名称:code-classifier,代码行数:7,代码来源:CSharp282Tests.cs

示例3: TestFixtureSetup

 public void TestFixtureSetup()
 {
     _server = MongoServer.Create("mongodb://localhost/?safe=true");
     _database = _server["onlinetests"];
     _collection = _database.GetCollection<GDA>("testcollection");
     _collection.Drop();
 }
开发者ID:moonreplace,项目名称:mongo-csharp-driver,代码行数:7,代码来源:CSharp265Tests.cs

示例4: TestFixtureSetup

 public void TestFixtureSetup()
 {
     _database = Configuration.TestDatabase;
     var collectionSettings = new MongoCollectionSettings() { GuidRepresentation = GuidRepresentation.Standard };
     _collection = _database.GetCollection<C>("csharp714", collectionSettings);
     _collection.Drop();
 }
开发者ID:GGsus,项目名称:mongo-csharp-driver,代码行数:7,代码来源:CSharp714Tests.cs

示例5: TestFixtureSetup

 public void TestFixtureSetup()
 {
     server = MongoServer.Create("mongodb://localhost/?safe=true");
     database = server["onlinetests"];
     collection = database["testcollection"];
     collection.Drop();
 }
开发者ID:kamaradclimber,项目名称:mongo-csharp-driver,代码行数:7,代码来源:CSharp282Tests.cs

示例6: CSharp714Tests

 public CSharp714Tests()
 {
     _database = LegacyTestConfiguration.Database;
     var collectionSettings = new MongoCollectionSettings() { GuidRepresentation = GuidRepresentation.Standard };
     _collection = _database.GetCollection<C>("csharp714", collectionSettings);
     _collection.Drop();
 }
开发者ID:RavenZZ,项目名称:MDRelation,代码行数:7,代码来源:CSharp714Tests.cs

示例7: CSharp840

 public CSharp840()
 {
     _collection = LegacyTestConfiguration.GetCollection<BsonDocument>();
     if (_collection.Exists()) { _collection.Drop(); }
     _collection.Insert(new BsonDocument { { "x", 1 } });
     _collection.Insert(new BsonDocument { { "x", 2 }, { "Length", BsonNull.Value } });
     _collection.Insert(new BsonDocument { { "x", 3 }, { "Length", 123 } });
 }
开发者ID:RavenZZ,项目名称:MDRelation,代码行数:8,代码来源:CSharp840Tests.cs

示例8: SetUp

 public void SetUp()
 {
     _collection = Configuration.GetTestCollection<BsonDocument>();
     if (_collection.Exists()) { _collection.Drop(); }
     _collection.Insert(new BsonDocument { { "x", 1 } });
     _collection.Insert(new BsonDocument { { "x", 2 }, { "Length", BsonNull.Value } });
     _collection.Insert(new BsonDocument { { "x", 3 }, { "Length", 123 } });
 }
开发者ID:niemyjski,项目名称:mongo-csharp-driver,代码行数:8,代码来源:CSharp840Tests.cs

示例9: Setup

 public void Setup()
 {
     r = new PostRepository();
     pb = new PostBuilder();
     MongoSetup();
     collection = database.GetCollection<Post>("posts");
     collection.Drop();
 }
开发者ID:andrea-scarcella,项目名称:asp.net-mvc-experiments,代码行数:8,代码来源:RepositoryUT.cs

示例10: MongoDbProcessManagerFinderTests

        public MongoDbProcessManagerFinderTests()
        {
            _connectionString = "mongodb://localhost/";
            _dbName = "ProcessManagerRepository";
            var mongoClient = new MongoClient(_connectionString);
            MongoServer server = mongoClient.GetServer();
            MongoDatabase mongoDatabase = server.GetDatabase(_dbName);
            _collection = mongoDatabase.GetCollection<TestData>("TestData");
            _collection.Drop();

            _mapper = new ProcessManagerPropertyMapper();
            _mapper.ConfigureMapping<IProcessManagerData, Message>(m => m.CorrelationId, pm => pm.CorrelationId);
        }
开发者ID:geffzhang,项目名称:ServiceConnect-CSharp,代码行数:13,代码来源:MongoDbProcessManagerFinderTests.cs

示例11: Setup

        public void Setup()
        {
            _collection = LegacyTestConfiguration.GetCollection<B>();

            _collection.Drop();
            _collection.CreateIndex(new IndexKeysBuilder().Ascending("a", "b"), IndexOptions.SetName("i"));
            _collection.CreateIndex(new IndexKeysBuilder().Ascending("a", "b"), IndexOptions.SetName("i"));

            _collection.Insert(new B { Id = ObjectId.GenerateNewId(), a = 1, b = 10, c = 100 });
            _collection.Insert(new B { Id = ObjectId.GenerateNewId(), a = 2, b = 20, c = 200 });
            _collection.Insert(new B { Id = ObjectId.GenerateNewId(), a = 3, b = 30, c = 300 });
            _collection.Insert(new B { Id = ObjectId.GenerateNewId(), a = 4, b = 40, c = 400 });
        }
开发者ID:kay-kim,项目名称:mongo-csharp-driver,代码行数:13,代码来源:WithIndexTests.cs

示例12: Setup

        public void Setup()
        {
            _collection = LegacyTestConfiguration.GetCollection<B>();

            _collection.Drop();
            _collection.CreateIndex("Value", "SubValues.Value");

            //numeric
            _collection.Insert(new B { Id = ObjectId.GenerateNewId(), Value = (byte)1, SubValues = new List<C>() { new C(2f), new C(3), new C(4D), new C(5UL) } });
            _collection.Insert(new B { Id = ObjectId.GenerateNewId(), Value = 2f, SubValues = new List<C>() { new C(6f), new C(7), new C(8D), new C(9UL) } });
            //strings
            _collection.Insert(new B { Id = ObjectId.GenerateNewId(), Value = "1", SubValues = new List<C>() { new C("2"), new C("3"), new C("4"), new C("5") } });
        }
开发者ID:fir3pho3nixx,项目名称:mongo-csharp-driver,代码行数:13,代码来源:CSharp900Tests.cs

示例13: Context

        public void Context()
        {
            var connectionStringUrl = new MongoUrl("mongodb://localhost/integration_tests");
            MongoDatabase mongoDatabase = MongoDatabase.Create(connectionStringUrl);
            mongoCollection = mongoDatabase.GetCollection("end_to_end_tests");
            if(mongoCollection.Exists())
            {
                mongoCollection.Drop();
            }

            var elementWithIEnumerableProperty = new ElementWithIEnumerableProperty{Name = "Test", Objects = new List<object>{"Test value for serialization"}.Select(x =>x)};
            mongoCollection.Insert(elementWithIEnumerableProperty);
        }
开发者ID:jenrom,项目名称:mongo-csharp-driver,代码行数:13,代码来源:GenericIEnumerableSerializationIssues.cs

示例14: Setup

        public void Setup()
        {
            server = MongoServer.Create("mongodb://localhost/?safe=true");
            server.Connect();
            database = server["onlinetests"];
            collection = database.GetCollection<C>("linqtests");

            collection.Drop();
            collection.Insert(new C { X = 1, Y = 11 });
            collection.Insert(new C { X = 2, Y = 12 });
            collection.Insert(new C { X = 3, Y = 13 });
            collection.Insert(new C { X = 4, Y = 14 });
            collection.Insert(new C { X = 5, Y = 15 });
        }
开发者ID:kamaradclimber,项目名称:mongo-csharp-driver,代码行数:14,代码来源:MongoLinqFindQueryTests.cs

示例15: Setup

        public void Setup()
        {
            _server = Configuration.TestServer;
            _server.Connect();
            _database = Configuration.TestDatabase;
            _collection = Configuration.GetTestCollection<C>();

            _collection.Drop();
            _collection.Insert(new C { X = 1, Y = 11 });
            _collection.Insert(new C { X = 2, Y = 12 });
            _collection.Insert(new C { X = 3, Y = 13 });
            _collection.Insert(new C { X = 4, Y = 14 });
            _collection.Insert(new C { X = 5, Y = 15 });
        }
开发者ID:ALyman,项目名称:mongo-csharp-driver,代码行数:14,代码来源:MongoLinqFindQueryTests.cs


注:本文中的MongoCollection.Drop方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。