Skip to content

Instantly share code, notes, and snippets.

@mgroves
Created June 22, 2016 15:28
Show Gist options
  • Save mgroves/6d764639c985f02a2b3093405d1a488d to your computer and use it in GitHub Desktop.
Save mgroves/6d764639c985f02a2b3093405d1a488d to your computer and use it in GitHub Desktop.
NotBoundedExample
private static void NotBoundedExample()
{
Console.WriteLine("========= NonBounded (default)");
// get the current count
var result1 =
_bucket.Query<dynamic>("SELECT COUNT(1) as airportCount FROM `travel-sample` WHERE type='airport'")
.Rows.First();
Console.WriteLine($"Initial count: {result1.airportCount}");
// insert a new airport
var doc = new Document<dynamic>
{
Id = "ScanConsistency::airport::" + _random.Next(10000),
Content = new
{
type = "airport"
}
};
_bucket.Insert(doc);
// get the count again
var result2 =
_bucket.Query<dynamic>("SELECT COUNT(1) as airportCount FROM `travel-sample` WHERE type='airport'")
.Rows.First();
Console.WriteLine($"Count after insert: {result2.airportCount}");
// wait a few seconds and get the count again
Console.Write("Waiting for 5 seconds...");
Thread.Sleep(5000);
var result3 =
_bucket.Query<dynamic>("SELECT COUNT(1) as airportCount FROM `travel-sample` WHERE type='airport'")
.Rows.First();
Console.WriteLine($"Count after waiting: {result3.airportCount}");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment