Skip to content

Commit a709f89

Browse files
DOCSP-28590 Add POCOs to fully runnable examples (#90)
1 parent 5609f22 commit a709f89

File tree

18 files changed

+738
-18
lines changed

18 files changed

+738
-18
lines changed

source/includes/code-examples/delete-many/DeleteMany.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,4 +53,44 @@ private static void Setup()
5353
var restaurantsDatabase = mongoClient.GetDatabase("sample_restaurants");
5454
_restaurantsCollection = restaurantsDatabase.GetCollection<Restaurant>("restaurants");
5555
}
56-
}
56+
}
57+
58+
public class Restaurant
59+
{
60+
public ObjectId Id { get; set; }
61+
62+
public string Name { get; set; }
63+
64+
[BsonElement("restaurant_id")]
65+
public string RestaurantId { get; set; }
66+
67+
public string Cuisine { get; set; }
68+
69+
public Address Address { get; set; }
70+
71+
public string Borough { get; set; }
72+
73+
public List<GradeEntry> Grades { get; set; }
74+
}
75+
76+
public class Address
77+
{
78+
public string Building { get; set; }
79+
80+
[BsonElement("coord")]
81+
public double[] Coordinates { get; set; }
82+
83+
public string Street { get; set; }
84+
85+
[BsonElement("zipcode")]
86+
public string ZipCode { get; set; }
87+
}
88+
89+
public class GradeEntry
90+
{
91+
public DateTime Date { get; set; }
92+
93+
public string Grade { get; set; }
94+
95+
public float Score { get; set; }
96+
}

source/includes/code-examples/delete-many/DeleteManyAsync.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,4 +55,44 @@ private static void Setup()
5555
var restaurantsDatabase = mongoClient.GetDatabase("sample_restaurants");
5656
_restaurantsCollection = restaurantsDatabase.GetCollection<Restaurant>("restaurants");
5757
}
58-
}
58+
}
59+
60+
public class Restaurant
61+
{
62+
public ObjectId Id { get; set; }
63+
64+
public string Name { get; set; }
65+
66+
[BsonElement("restaurant_id")]
67+
public string RestaurantId { get; set; }
68+
69+
public string Cuisine { get; set; }
70+
71+
public Address Address { get; set; }
72+
73+
public string Borough { get; set; }
74+
75+
public List<GradeEntry> Grades { get; set; }
76+
}
77+
78+
public class Address
79+
{
80+
public string Building { get; set; }
81+
82+
[BsonElement("coord")]
83+
public double[] Coordinates { get; set; }
84+
85+
public string Street { get; set; }
86+
87+
[BsonElement("zipcode")]
88+
public string ZipCode { get; set; }
89+
}
90+
91+
public class GradeEntry
92+
{
93+
public DateTime Date { get; set; }
94+
95+
public string Grade { get; set; }
96+
97+
public float Score { get; set; }
98+
}

source/includes/code-examples/delete-one/DeleteOne.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,44 @@ private static void Setup()
5252
var restaurantsDatabase = mongoClient.GetDatabase("sample_restaurants");
5353
_restaurantsCollection = restaurantsDatabase.GetCollection<Restaurant>("restaurants");
5454
}
55-
}
55+
}
56+
57+
public class Restaurant
58+
{
59+
public ObjectId Id { get; set; }
60+
61+
public string Name { get; set; }
62+
63+
[BsonElement("restaurant_id")]
64+
public string RestaurantId { get; set; }
65+
66+
public string Cuisine { get; set; }
67+
68+
public Address Address { get; set; }
69+
70+
public string Borough { get; set; }
71+
72+
public List<GradeEntry> Grades { get; set; }
73+
}
74+
75+
public class Address
76+
{
77+
public string Building { get; set; }
78+
79+
[BsonElement("coord")]
80+
public double[] Coordinates { get; set; }
81+
82+
public string Street { get; set; }
83+
84+
[BsonElement("zipcode")]
85+
public string ZipCode { get; set; }
86+
}
87+
88+
public class GradeEntry
89+
{
90+
public DateTime Date { get; set; }
91+
92+
public string Grade { get; set; }
93+
94+
public float Score { get; set; }
95+
}

source/includes/code-examples/delete-one/DeleteOneAsync.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,4 +52,44 @@ private static void Setup()
5252
var restaurantsDatabase = mongoClient.GetDatabase("sample_restaurants");
5353
_restaurantsCollection = restaurantsDatabase.GetCollection<Restaurant>("restaurants");
5454
}
55-
}
55+
}
56+
57+
public class Restaurant
58+
{
59+
public ObjectId Id { get; set; }
60+
61+
public string Name { get; set; }
62+
63+
[BsonElement("restaurant_id")]
64+
public string RestaurantId { get; set; }
65+
66+
public string Cuisine { get; set; }
67+
68+
public Address Address { get; set; }
69+
70+
public string Borough { get; set; }
71+
72+
public List<GradeEntry> Grades { get; set; }
73+
}
74+
75+
public class Address
76+
{
77+
public string Building { get; set; }
78+
79+
[BsonElement("coord")]
80+
public double[] Coordinates { get; set; }
81+
82+
public string Street { get; set; }
83+
84+
[BsonElement("zipcode")]
85+
public string ZipCode { get; set; }
86+
}
87+
88+
public class GradeEntry
89+
{
90+
public DateTime Date { get; set; }
91+
92+
public string Grade { get; set; }
93+
94+
public float Score { get; set; }
95+
}

source/includes/code-examples/find-many/FindMany.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,4 +72,44 @@ private static void Setup()
7272
var restaurantsDatabase = mongoClient.GetDatabase("sample_restaurants");
7373
_restaurantsCollection = restaurantsDatabase.GetCollection<Restaurant>("restaurants");
7474
}
75-
}
75+
}
76+
77+
public class Restaurant
78+
{
79+
public ObjectId Id { get; set; }
80+
81+
public string Name { get; set; }
82+
83+
[BsonElement("restaurant_id")]
84+
public string RestaurantId { get; set; }
85+
86+
public string Cuisine { get; set; }
87+
88+
public Address Address { get; set; }
89+
90+
public string Borough { get; set; }
91+
92+
public List<GradeEntry> Grades { get; set; }
93+
}
94+
95+
public class Address
96+
{
97+
public string Building { get; set; }
98+
99+
[BsonElement("coord")]
100+
public double[] Coordinates { get; set; }
101+
102+
public string Street { get; set; }
103+
104+
[BsonElement("zipcode")]
105+
public string ZipCode { get; set; }
106+
}
107+
108+
public class GradeEntry
109+
{
110+
public DateTime Date { get; set; }
111+
112+
public string Grade { get; set; }
113+
114+
public float Score { get; set; }
115+
}

source/includes/code-examples/find-many/FindManyAsync.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,4 +73,44 @@ private static void Setup()
7373
var restaurantsDatabase = mongoClient.GetDatabase("sample_restaurants");
7474
_restaurantsCollection = restaurantsDatabase.GetCollection<Restaurant>("restaurants");
7575
}
76-
}
76+
}
77+
78+
public class Restaurant
79+
{
80+
public ObjectId Id { get; set; }
81+
82+
public string Name { get; set; }
83+
84+
[BsonElement("restaurant_id")]
85+
public string RestaurantId { get; set; }
86+
87+
public string Cuisine { get; set; }
88+
89+
public Address Address { get; set; }
90+
91+
public string Borough { get; set; }
92+
93+
public List<GradeEntry> Grades { get; set; }
94+
}
95+
96+
public class Address
97+
{
98+
public string Building { get; set; }
99+
100+
[BsonElement("coord")]
101+
public double[] Coordinates { get; set; }
102+
103+
public string Street { get; set; }
104+
105+
[BsonElement("zipcode")]
106+
public string ZipCode { get; set; }
107+
}
108+
109+
public class GradeEntry
110+
{
111+
public DateTime Date { get; set; }
112+
113+
public string Grade { get; set; }
114+
115+
public float Score { get; set; }
116+
}

source/includes/code-examples/find-one/FindOne.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,4 +58,44 @@ private static void Setup()
5858
var restaurantsDatabase = mongoClient.GetDatabase("sample_restaurants");
5959
_restaurantsCollection = restaurantsDatabase.GetCollection<Restaurant>("restaurants");
6060
}
61-
}
61+
}
62+
63+
public class Restaurant
64+
{
65+
public ObjectId Id { get; set; }
66+
67+
public string Name { get; set; }
68+
69+
[BsonElement("restaurant_id")]
70+
public string RestaurantId { get; set; }
71+
72+
public string Cuisine { get; set; }
73+
74+
public Address Address { get; set; }
75+
76+
public string Borough { get; set; }
77+
78+
public List<GradeEntry> Grades { get; set; }
79+
}
80+
81+
public class Address
82+
{
83+
public string Building { get; set; }
84+
85+
[BsonElement("coord")]
86+
public double[] Coordinates { get; set; }
87+
88+
public string Street { get; set; }
89+
90+
[BsonElement("zipcode")]
91+
public string ZipCode { get; set; }
92+
}
93+
94+
public class GradeEntry
95+
{
96+
public DateTime Date { get; set; }
97+
98+
public string Grade { get; set; }
99+
100+
public float Score { get; set; }
101+
}

source/includes/code-examples/find-one/FindOneAsync.cs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,4 +57,44 @@ private static void Setup()
5757
var restaurantsDatabase = mongoClient.GetDatabase("sample_restaurants");
5858
_restaurantsCollection = restaurantsDatabase.GetCollection<Restaurant>("restaurants");
5959
}
60-
}
60+
}
61+
62+
public class Restaurant
63+
{
64+
public ObjectId Id { get; set; }
65+
66+
public string Name { get; set; }
67+
68+
[BsonElement("restaurant_id")]
69+
public string RestaurantId { get; set; }
70+
71+
public string Cuisine { get; set; }
72+
73+
public Address Address { get; set; }
74+
75+
public string Borough { get; set; }
76+
77+
public List<GradeEntry> Grades { get; set; }
78+
}
79+
80+
public class Address
81+
{
82+
public string Building { get; set; }
83+
84+
[BsonElement("coord")]
85+
public double[] Coordinates { get; set; }
86+
87+
public string Street { get; set; }
88+
89+
[BsonElement("zipcode")]
90+
public string ZipCode { get; set; }
91+
}
92+
93+
public class GradeEntry
94+
{
95+
public DateTime Date { get; set; }
96+
97+
public string Grade { get; set; }
98+
99+
public float Score { get; set; }
100+
}

0 commit comments

Comments
 (0)