Skip to content

Commit ff6cf72

Browse files
committed
CSHARP-2310: Add API-level documentation for restriction of geo commands in count helpers.
1 parent 0d083ab commit ff6cf72

File tree

2 files changed

+90
-0
lines changed

2 files changed

+90
-0
lines changed

src/MongoDB.Driver/IFindFluent.cs

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,13 +68,43 @@ public interface IFindFluent<TDocument, TProjection> : IAsyncCursorSource<TProje
6868
/// <summary>
6969
/// Counts the number of documents.
7070
/// </summary>
71+
/// <remarks>
72+
/// Note: when migrating from Count to CountDocuments the following query operations must be replaced:
73+
///
74+
/// <code>
75+
/// +-------------+--------------------------------+
76+
/// | Operator | Replacement |
77+
/// +=============+================================+
78+
/// | $where | $expr |
79+
/// +-------------+--------------------------------+
80+
/// | $near | $geoWithin with $center |
81+
/// +-------------+--------------------------------+
82+
/// | $nearSphere | $geoWithin with $centerSphere |
83+
/// +-------------+--------------------------------+
84+
/// </code>
85+
/// </remarks>
7186
/// <param name="cancellationToken">The cancellation token.</param>
7287
/// <returns>The count.</returns>
7388
long CountDocuments(CancellationToken cancellationToken = default(CancellationToken));
7489

7590
/// <summary>
7691
/// Counts the number of documents.
7792
/// </summary>
93+
/// <remarks>
94+
/// Note: when migrating from CountAsync to CountDocumentsAsync the following query operations must be replaced:
95+
///
96+
/// <code>
97+
/// +-------------+--------------------------------+
98+
/// | Operator | Replacement |
99+
/// +=============+================================+
100+
/// | $where | $expr |
101+
/// +-------------+--------------------------------+
102+
/// | $near | $geoWithin with $center |
103+
/// +-------------+--------------------------------+
104+
/// | $nearSphere | $geoWithin with $centerSphere |
105+
/// +-------------+--------------------------------+
106+
/// </code>
107+
/// </remarks>
78108
/// <param name="cancellationToken">The cancellation token.</param>
79109
/// <returns>A Task whose result is the count.</returns>
80110
Task<long> CountDocumentsAsync(CancellationToken cancellationToken = default(CancellationToken));

src/MongoDB.Driver/IMongoCollection.cs

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,21 @@ public interface IMongoCollection<TDocument>
198198
/// <summary>
199199
/// Counts the number of documents in the collection.
200200
/// </summary>
201+
/// <remarks>
202+
/// Note: when migrating from Count to CountDocuments the following query operations must be replaced:
203+
///
204+
/// <code>
205+
/// +-------------+--------------------------------+
206+
/// | Operator | Replacement |
207+
/// +=============+================================+
208+
/// | $where | $expr |
209+
/// +-------------+--------------------------------+
210+
/// | $near | $geoWithin with $center |
211+
/// +-------------+--------------------------------+
212+
/// | $nearSphere | $geoWithin with $centerSphere |
213+
/// +-------------+--------------------------------+
214+
/// </code>
215+
/// </remarks>
201216
/// <param name="filter">The filter.</param>
202217
/// <param name="options">The options.</param>
203218
/// <param name="cancellationToken">The cancellation token.</param>
@@ -209,6 +224,21 @@ public interface IMongoCollection<TDocument>
209224
/// <summary>
210225
/// Counts the number of documents in the collection.
211226
/// </summary>
227+
/// <remarks>
228+
/// Note: when migrating from Count to CountDocuments the following query operations must be replaced:
229+
///
230+
/// <code>
231+
/// +-------------+--------------------------------+
232+
/// | Operator | Replacement |
233+
/// +=============+================================+
234+
/// | $where | $expr |
235+
/// +-------------+--------------------------------+
236+
/// | $near | $geoWithin with $center |
237+
/// +-------------+--------------------------------+
238+
/// | $nearSphere | $geoWithin with $centerSphere |
239+
/// +-------------+--------------------------------+
240+
/// </code>
241+
/// </remarks>
212242
/// <param name="session">The session.</param>
213243
/// <param name="filter">The filter.</param>
214244
/// <param name="options">The options.</param>
@@ -221,6 +251,21 @@ public interface IMongoCollection<TDocument>
221251
/// <summary>
222252
/// Counts the number of documents in the collection.
223253
/// </summary>
254+
/// <remarks>
255+
/// Note: when migrating from CountAsync to CountDocumentsAsync the following query operations must be replaced:
256+
///
257+
/// <code>
258+
/// +-------------+--------------------------------+
259+
/// | Operator | Replacement |
260+
/// +=============+================================+
261+
/// | $where | $expr |
262+
/// +-------------+--------------------------------+
263+
/// | $near | $geoWithin with $center |
264+
/// +-------------+--------------------------------+
265+
/// | $nearSphere | $geoWithin with $centerSphere |
266+
/// +-------------+--------------------------------+
267+
/// </code>
268+
/// </remarks>
224269
/// <param name="filter">The filter.</param>
225270
/// <param name="options">The options.</param>
226271
/// <param name="cancellationToken">The cancellation token.</param>
@@ -232,6 +277,21 @@ public interface IMongoCollection<TDocument>
232277
/// <summary>
233278
/// Counts the number of documents in the collection.
234279
/// </summary>
280+
/// <remarks>
281+
/// Note: when migrating from CountAsync to CountDocumentsAsync the following query operations must be replaced:
282+
///
283+
/// <code>
284+
/// +-------------+--------------------------------+
285+
/// | Operator | Replacement |
286+
/// +=============+================================+
287+
/// | $where | $expr |
288+
/// +-------------+--------------------------------+
289+
/// | $near | $geoWithin with $center |
290+
/// +-------------+--------------------------------+
291+
/// | $nearSphere | $geoWithin with $centerSphere |
292+
/// +-------------+--------------------------------+
293+
/// </code>
294+
/// </remarks>
235295
/// <param name="session">The session.</param>
236296
/// <param name="filter">The filter.</param>
237297
/// <param name="options">The options.</param>

0 commit comments

Comments
 (0)