Commit 797b1f71 authored by Savorboard's avatar Savorboard

update samples

parent 401cc6f0
...@@ -26,7 +26,7 @@ namespace Sample.RabbitMQ.MongoDB.Controllers ...@@ -26,7 +26,7 @@ namespace Sample.RabbitMQ.MongoDB.Controllers
//mycollection.InsertOne(new BsonDocument { { "test", "test" } }); //mycollection.InsertOne(new BsonDocument { { "test", "test" } });
using (var session = _client.StartSession()) using (var session = _client.StartSession())
using (var trans = _capPublisher.CapTransaction.Begin(session)) using (var trans = _capPublisher.Transaction.Begin(session))
{ {
var collection = _client.GetDatabase("test").GetCollection<BsonDocument>("test.collection"); var collection = _client.GetDatabase("test").GetCollection<BsonDocument>("test.collection");
collection.InsertOne(session, new BsonDocument { { "hello", "world" } }); collection.InsertOne(session, new BsonDocument { { "hello", "world" } });
...@@ -42,7 +42,7 @@ namespace Sample.RabbitMQ.MongoDB.Controllers ...@@ -42,7 +42,7 @@ namespace Sample.RabbitMQ.MongoDB.Controllers
public IActionResult PublishNotAutoCommit() public IActionResult PublishNotAutoCommit()
{ {
using (var session = _client.StartSession()) using (var session = _client.StartSession())
using (_capPublisher.CapTransaction.Begin(session, true)) using (_capPublisher.Transaction.Begin(session, true))
{ {
var collection = _client.GetDatabase("test").GetCollection<BsonDocument>("test.collection"); var collection = _client.GetDatabase("test").GetCollection<BsonDocument>("test.collection");
collection.InsertOne(session, new BsonDocument { { "hello2", "world2" } }); collection.InsertOne(session, new BsonDocument { { "hello2", "world2" } });
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment