This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var document = new BsonDocument { { "_id", 1 }, { "x", 2 } }; | |
await collection.InsertOneAsync(document); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var filter = new BsonDocument("x", new BsonDocument("$gte", 100)); | |
var documents = await collection.Find(filter).ToListAsync(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var filter = new BsonDocument("x", new BsonDocument("$gte", 100)); | |
var documents = await collection.Find(filter).ToListAsync(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var filter = new BsonDocument("x", new BsonDocument("$gte", 100)); | |
await collection.Find(filter).ForEachAsync(async document => | |
{ | |
await ProcessDocumentAsync(document); | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = new MongoClient("mongodb://localhost"); | |
var server = client.GetServer(); | |
var database = server.GetDatabase("test"); // this database uses the legacy API |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = new MongoClient("mongodb://localhost"); | |
var database = client.GetDatabase("test"); // this database uses the new API |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var client = new MongoClient("mongodb://localhost"); | |
var database = client.GetDatabase("foo"); | |
var collection = database.GetCollection<BsonDocument>("bar"); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var document = new BsonDocument { { "_id", 1 }, { "x", 2 } }; | |
await collection.InsertOneAsync(document); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
shard01:PRIMARY> c = db.oplog.rs.find( { fromMigrate : { $exists : false } } ).addOption( DBQuery.Option.tailable ).addOption(DBQuery.Option.awaitData) | |
{ "ts" : Timestamp(1422998530, 1), "h" : NumberLong(0), "v" : 2, "op" : "n", "ns" : "", "o" : { "msg" : "initiating set" } } | |
{ "ts" : Timestamp(1422998574, 1), "h" : NumberLong("-6781014703318499311"), "v" : 2, "op" : "i", "ns" : "test.mycollection", "o" : { "_id" : 1, "data" : "hello" } } | |
{ "ts" : Timestamp(1422998579, 1), "h" : NumberLong("-217362260421471244"), "v" : 2, "op" : "i", "ns" : "test.mycollection", "o" : { "_id" : 3, "data" : "hello" } } | |
{ "ts" : Timestamp(1422998584, 1), "h" : NumberLong("7215322058367374253"), "v" : 2, "op" : "i", "ns" : "test.mycollection", "o" : { "_id" : 5, "data" : "hello" } } | |
shard01:PRIMARY> c.hasNext() | |
true | |
shard01:PRIMARY> c.next() | |
{ | |
"ts" : Timestamp(1423049506, 1), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
meteor:PRIMARY> db.currentOp() | |
{ | |
"inprog" : [ | |
{ | |
"opid" : 345, | |
"active" : true, | |
"secs_running" : 4, | |
"op" : "getmore", | |
"ns" : "local.oplog.rs", | |
"query" : { |