Skip to content

Commit 7c8e1de

Browse files
committed
move geoNear methods to IAggregateFluentExtensions.cs
1 parent 04ddd36 commit 7c8e1de

File tree

4 files changed

+39
-85
lines changed

4 files changed

+39
-85
lines changed

src/MongoDB.Driver/AggregateFluent.cs

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
using MongoDB.Bson;
2121
using MongoDB.Bson.Serialization;
2222
using MongoDB.Driver.Core.Misc;
23-
using MongoDB.Driver.GeoJsonObjectModel;
2423
using MongoDB.Driver.Search;
2524

2625
namespace MongoDB.Driver
@@ -130,27 +129,6 @@ public override IAggregateFluent<TNewResult> Facet<TNewResult>(
130129
{
131130
return WithPipeline(_pipeline.Facet(facets, options));
132131
}
133-
134-
public override IAggregateFluent<TNewResult> GeoNear<TCoordinates, TNewResult>(
135-
GeoJsonPoint<TCoordinates> near,
136-
GeoNearOptions<TResult> options = null)
137-
{
138-
return WithPipeline(_pipeline.GeoNear<TInput, TResult, TCoordinates, TNewResult>(near, options));
139-
}
140-
141-
public override IAggregateFluent<TNewResult> GeoNear<TCoordinates, TNewResult>(
142-
TCoordinates[] near,
143-
GeoNearOptions<TResult> options = null)
144-
{
145-
return WithPipeline(_pipeline.GeoNear<TInput, TResult, TCoordinates, TNewResult>(near, options));
146-
}
147-
148-
public override IAggregateFluent<TNewResult> GeoNear<TNewResult>(
149-
BsonDocument near,
150-
GeoNearOptions<TResult> options = null)
151-
{
152-
return WithPipeline(_pipeline.GeoNear<TInput, TResult, TNewResult>(near, options));
153-
}
154132

155133
public override IAggregateFluent<TNewResult> GraphLookup<TFrom, TConnectFrom, TConnectTo, TStartWith, TAsElement, TAs, TNewResult>(
156134
IMongoCollection<TFrom> from,

src/MongoDB.Driver/AggregateFluentBase.cs

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
using System.Threading.Tasks;
2020
using MongoDB.Bson;
2121
using MongoDB.Bson.Serialization;
22-
using MongoDB.Driver.GeoJsonObjectModel;
2322
using MongoDB.Driver.Search;
2423

2524
namespace MongoDB.Driver
@@ -125,31 +124,6 @@ public virtual IAggregateFluent<TNewResult> Facet<TNewResult>(
125124
throw new NotImplementedException();
126125
}
127126

128-
/// <inheritdoc />
129-
public virtual IAggregateFluent<TNewResult> GeoNear<TCoordinates, TNewResult>(
130-
GeoJsonPoint<TCoordinates> near,
131-
GeoNearOptions<TResult> options = null)
132-
where TCoordinates : GeoJsonCoordinates
133-
{
134-
throw new NotImplementedException();
135-
}
136-
137-
/// <inheritdoc />
138-
public virtual IAggregateFluent<TNewResult> GeoNear<TCoordinates, TNewResult>(
139-
TCoordinates[] near,
140-
GeoNearOptions<TResult> options = null)
141-
{
142-
throw new NotImplementedException();
143-
}
144-
145-
/// <inheritdoc />
146-
public virtual IAggregateFluent<TNewResult> GeoNear<TNewResult>(
147-
BsonDocument near,
148-
GeoNearOptions<TResult> options = null)
149-
{
150-
throw new NotImplementedException();
151-
}
152-
153127
/// <inheritdoc />
154128
public virtual IAggregateFluent<TNewResult> GraphLookup<TFrom, TConnectFrom, TConnectTo, TStartWith, TAsElement, TAs, TNewResult>(
155129
IMongoCollection<TFrom> from,

src/MongoDB.Driver/IAggregateFluent.cs

Lines changed: 0 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
using System.Threading.Tasks;
2020
using MongoDB.Bson;
2121
using MongoDB.Bson.Serialization;
22-
using MongoDB.Driver.GeoJsonObjectModel;
2322
using MongoDB.Driver.Search;
2423

2524
namespace MongoDB.Driver
@@ -176,42 +175,6 @@ IAggregateFluent<TNewResult> Facet<TNewResult>(
176175
IEnumerable<AggregateFacet<TResult>> facets,
177176
AggregateFacetOptions<TNewResult> options = null);
178177

179-
/// <summary>
180-
/// Appends a $geoNear stage to the pipeline.
181-
/// </summary>
182-
/// <typeparam name="TNewResult">The type of the new result.</typeparam>
183-
/// <typeparam name="TCoordinates">The type of the coordinates for the point.</typeparam>
184-
/// <param name="near">The point for which to find the closest documents.</param>
185-
/// <param name="options">The options.</param>
186-
/// <returns>The fluent aggregate interface.</returns>
187-
IAggregateFluent<TNewResult> GeoNear<TCoordinates, TNewResult>(
188-
GeoJsonPoint<TCoordinates> near,
189-
GeoNearOptions<TResult> options = null)
190-
where TCoordinates : GeoJsonCoordinates;
191-
192-
/// <summary>
193-
/// Appends a $geoNear stage to the pipeline.
194-
/// </summary>
195-
/// <typeparam name="TNewResult">The type of the new result.</typeparam>
196-
/// <typeparam name="TCoordinates">The type of the coordinates for the point.</typeparam>
197-
/// <param name="near">The point for which to find the closest documents.</param>
198-
/// <param name="options">The options.</param>
199-
/// <returns>The fluent aggregate interface.</returns>
200-
IAggregateFluent<TNewResult> GeoNear<TCoordinates, TNewResult>(
201-
TCoordinates[] near,
202-
GeoNearOptions<TResult> options = null);
203-
204-
/// <summary>
205-
/// Appends a $geoNear stage to the pipeline.
206-
/// </summary>
207-
/// <typeparam name="TNewResult">The type of the new result.</typeparam>
208-
/// <param name="near">The point for which to find the closest documents.</param>
209-
/// <param name="options">The options.</param>
210-
/// <returns>The fluent aggregate interface.</returns>
211-
IAggregateFluent<TNewResult> GeoNear<TNewResult>(
212-
BsonDocument near,
213-
GeoNearOptions<TResult> options = null);
214-
215178
/// <summary>
216179
/// Appends a $graphLookup stage to the pipeline.
217180
/// </summary>

src/MongoDB.Driver/IAggregateFluentExtensions.cs

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -253,6 +253,45 @@ public static IAggregateFluent<TNewResult> Facet<TResult, TNewResult>(
253253
return aggregate.AppendStage(PipelineStageDefinitionBuilder.Facet<TResult, TNewResult>(facets));
254254
}
255255

256+
/// <summary>
257+
/// Appends a $geoNear stage to the pipeline.
258+
/// </summary>
259+
/// <typeparam name="TResult">The type of the result.</typeparam>
260+
/// <typeparam name="TNewResult">The type of the new result.</typeparam>
261+
/// <typeparam name="TCoordinates">The type of the coordinates for the point.</typeparam>
262+
/// <param name="aggregate">The aggregate.</param>
263+
/// <param name="near">The point for which to find the closest documents.</param>
264+
/// <param name="options">The options.</param>
265+
/// <returns>The fluent aggregate interface.</returns>
266+
public static IAggregateFluent<TNewResult> GeoNear<TCoordinates, TResult, TNewResult>(
267+
this IAggregateFluent<TResult> aggregate,
268+
GeoJsonPoint<TCoordinates> near,
269+
GeoNearOptions<TResult> options = null)
270+
where TCoordinates : GeoJsonCoordinates
271+
{
272+
Ensure.IsNotNull(aggregate, nameof(aggregate));
273+
return aggregate.AppendStage(PipelineStageDefinitionBuilder.GeoNear<TResult, GeoJsonPoint<TCoordinates>, TNewResult>(near, options));
274+
}
275+
276+
/// <summary>
277+
/// Appends a $geoNear stage to the pipeline.
278+
/// </summary>
279+
/// <typeparam name="TResult">The type of the result.</typeparam>
280+
/// <typeparam name="TNewResult">The type of the new result.</typeparam>
281+
/// <typeparam name="TCoordinates">The type of the coordinates for the point.</typeparam>
282+
/// <param name="aggregate">The aggregate.</param>
283+
/// <param name="near">The point for which to find the closest documents.</param>
284+
/// <param name="options">The options.</param>
285+
/// <returns>The fluent aggregate interface.</returns>
286+
public static IAggregateFluent<TNewResult> GeoNear<TCoordinates, TResult, TNewResult>(
287+
this IAggregateFluent<TResult> aggregate,
288+
TCoordinates[] near,
289+
GeoNearOptions<TResult> options = null)
290+
{
291+
Ensure.IsNotNull(aggregate, nameof(aggregate));
292+
return aggregate.AppendStage(PipelineStageDefinitionBuilder.GeoNear<TResult, TCoordinates, TNewResult>(near, options));
293+
}
294+
256295
/// <summary>
257296
/// Appends a $graphLookup stage to the pipeline.
258297
/// </summary>

0 commit comments

Comments
 (0)