flongo 1.5.0 → 1.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/flongoQuery.d.ts +9 -0
- package/dist/flongoQuery.js +18 -0
- package/package.json +1 -1
package/dist/flongoQuery.d.ts
CHANGED
|
@@ -214,6 +214,15 @@ export declare class FlongoQuery implements ICollectionQuery {
|
|
|
214
214
|
* @returns This query instance for chaining
|
|
215
215
|
*/
|
|
216
216
|
geoWithin(bounds?: Bounds): FlongoQuery;
|
|
217
|
+
/**
|
|
218
|
+
* Performs a proximity query using MongoDB's $near operator
|
|
219
|
+
* Requires a 2dsphere index on the target field
|
|
220
|
+
* Results are automatically sorted by distance (nearest first)
|
|
221
|
+
* @param center - Center point coordinates
|
|
222
|
+
* @param maxDistanceMeters - Maximum distance in meters
|
|
223
|
+
* @returns This query instance for chaining
|
|
224
|
+
*/
|
|
225
|
+
near(center: Coordinates, maxDistanceMeters: number): FlongoQuery;
|
|
217
226
|
/**
|
|
218
227
|
* Sets the field and direction for sorting results
|
|
219
228
|
* @param field - Field name to sort by
|
package/dist/flongoQuery.js
CHANGED
|
@@ -330,6 +330,24 @@ class FlongoQuery {
|
|
|
330
330
|
}
|
|
331
331
|
return this;
|
|
332
332
|
}
|
|
333
|
+
/**
|
|
334
|
+
* Performs a proximity query using MongoDB's $near operator
|
|
335
|
+
* Requires a 2dsphere index on the target field
|
|
336
|
+
* Results are automatically sorted by distance (nearest first)
|
|
337
|
+
* @param center - Center point coordinates
|
|
338
|
+
* @param maxDistanceMeters - Maximum distance in meters
|
|
339
|
+
* @returns This query instance for chaining
|
|
340
|
+
*/
|
|
341
|
+
near(center, maxDistanceMeters) {
|
|
342
|
+
this.set("$near", {
|
|
343
|
+
$geometry: {
|
|
344
|
+
type: "Point",
|
|
345
|
+
coordinates: [center.longitude, center.latitude]
|
|
346
|
+
},
|
|
347
|
+
$maxDistance: maxDistanceMeters
|
|
348
|
+
});
|
|
349
|
+
return this;
|
|
350
|
+
}
|
|
333
351
|
// ===========================================
|
|
334
352
|
// SORTING
|
|
335
353
|
// ===========================================
|