Questions tagged [geonear]
33 questions
1
vote
0 answers
Geo Near with more conditions in mongodb
I am trying geoNear query in mongodb and i added extra query in query params in geoNear without lat,long.
Example:
searchQuery = [
{ "postLocationType": { $exists: true } },
{ "languageType": mongoose.Types.ObjectId(body.languageType) },
{…

Jayesh Mathur
- 11
- 1
0
votes
0 answers
Too many geoNear expressions error in MongoDB
{$and:[{
'polylineLocs': {
'$nearSphere': {
'$geometry': {
'type': 'Point',
'coordinates':
[78.02478824054135,
30.29090638871556
]
},
…

Mathomania
- 13
- 2
- 4
0
votes
0 answers
unable to find index for $geoNear query using nestjs and mongoose
I keep getting the "unable to find index for $geoNear query" error. I'm using nestjs and mongoose. Below is the original code when I first got the error. I then tried adding "this.locationModel.createIndexes({ location: "2dsphere" });" (mongoose…

antwaing
- 11
- 3
0
votes
0 answers
MongoDB: adding a field from another collection with geoNear
I have two collections, which both have Geospatial Indexes:
people
[
{
"name": "Steve",
...
"geometry": {"type": "Point", "coordinates": [90, 90]}
},
{
"name": "John",
...
"geometry": {"type": "Point", "coordinates":…

corcufos
- 1
- 2
0
votes
1 answer
Nearest point to set of line segments
I have a point p, and n line segments in the 2d space. Is there a way I can preprocess the line segments so that I can efficiently (i.e. sublineraly) find the line segment closest (i.e with lowest perpendicular distance) to P?
This is a real-world…

ranban282
- 148
- 1
- 14
0
votes
0 answers
MongoDB - use maxDistance $geoNear between stored docs without specifing coordinates in query
lets say is have multiple docs with geo coordinates in mongodb
{"_id" : .., "userID" : "1", "point: {"type" : "Point", "coordinates" : [
8.8502715,
45.6114064
]}}
{"_id" : .., "userID" : "1", "point: {"type" : "Point", "coordinates" :…
0
votes
0 answers
$geoNear give result only if I give maxDistance = 100 * 1000;
I want a list of Lawyers nearby,
I have used MongoDB aggregation but it gives results only if I pass maxDistance greater than 100km.
if I want to set maxDistance = 10 * 1000; then it is not giving any result but there are data available in the…

JIGNESH PATEL
- 367
- 4
- 17
0
votes
0 answers
use geonear with fuzzy search text mongodb
I have the following query
db.hotels.aggregate([
{
$search: {
index:'txtIdx', // this is the index name
text: {
query:"sun",
…
user14641790
0
votes
0 answers
Mongodb $geonear from joining two collections: Calculate distance from coordinates
We have mongodb collections
users
{
_id: "1",
location: { coordinates: [ -63, 42 ], type: "Point" },
name: "user one"
},
{
_id: "2",
location: { coordinates: [ -83, 52 ], type: "Point" },
name: "user two"
}
{
_id:…

user3419778
- 856
- 3
- 8
- 11
0
votes
0 answers
.count aggregate significantly slows execution time
I am refactoring some old code to hope to speed up and make information more secure. In order to do so I am trying to use the MongoDB aggregation framework to get all users near a specific location. Originally this was being solved by handling…

SKeney
- 1,965
- 2
- 8
- 30
0
votes
0 answers
Node - using MongoDB for aggregate and geoNear
I'm trying to write a simple node app for finding nearby users. I'm using Mongo 5.9.11 for the aggregate function and the $geoNear, but unfortunately when I try to run the app and find users, I get back an empty array - not even an error…

Chens
- 1
0
votes
0 answers
How to build Mongoose query for distance and something else
I have a schema like this.
const Company = new mongoose.Schema({
profile: {
name: String,
email: String,
password: String,
description: String,
phone: String,
location: {
address:…

Excalibur
- 325
- 2
- 5
- 15
0
votes
0 answers
MongoDB $geoNear result separate distance from returned document
I am running a MongoDB query in .NET application that is using $geoNear aggregation stage and returns a list of object within a specified distance. It is returning them in following format (I am using results from MongoDB examples page for…

Marcin Bator
- 341
- 1
- 8
- 23
0
votes
1 answer
no such command: 'geoNear', when using geo_near with mongoid
I want to make look around feature in my app using geo_near
i already make index on my model
...
field :location, Type: Array
index({ location: "2d" })
self.create_indexes
i already run
rake db:mongoid:create_indexes
here code i…
0
votes
0 answers
Keep null location with Geonear
I'm in PHP and i have a document that may have a location or not and I use geonear on it. I want to keep the location with null value. How can i do ?
[
'$geoNear' => [
'near' => [
'type' => 'Point',
'coordinates' =>…

MMS
- 23
- 2