-
-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PFGeoPoint - index is not created automatically #4813
Comments
How are you running nearby query? Are using query.near() or Mongo Shell? |
Hi @dplewis I am using the cloud code and there I'm using the JavaScript parse SDK (withinMiles) |
@ranhsd If you can debug here. It looks like your error message is different. Can you post your logs VERBOSE=1? and which version of Mongo are you using. |
@dplewis I think the issue is that the index was not created by Parse automatically @ranhsd Parse only creates a 2dsphere index automatically if the field is specified as a Polygon createIndexesIfNeeded(className: string, fieldName: string, type: any) {
if (type && type.type === 'Polygon') {
const index = {
[fieldName]: '2dsphere'
};
return this.createIndex(className, index);
}
return Promise.resolve();
} If you want a 2dsphere index you need to specifically create it: const index = {
location: "2dsphere"
}
mySchema.addIndex('location', index)
mySchema.save() Hope that helps! |
@joshkopecek Auto generating an index for
|
Just tried it without an index and it worked (created an index and ran the query) for me, running v2.8.1 on localhost. |
@joshkopecek Its not working for @ranhsd tho [insert sad face emoji] |
Hi @joshkopecek and @dplewis It doesn't work for me in the latest release which is 2.8.2. Thanks! |
@ranhsd Can you debug it? I’ll look into it this weekend. |
@ranhsd Does it work in 2.8.1? |
Hi @dplewis I didn't had the time to check it. Will do it soon. Sorry I am very busy lately... |
@ranhsd any chance it's ok now? Perhaps the index was deleted inadvertently? |
Just notice that I was sending the latitude for both lat/lng 😣 it's working now you can ignore my previous message. |
Hi, As much as I know PFGeoPoint field should be auto indexed by parse but it doesn't seems to work now. I don't know if it is a bug in the latest version (2.8.2).
For this project I am using MLAB as my database. My model looks like the following:
And I see that the class was created with the coordinates values in the dashboard
When I am trying to run a nearby query I am getting the following error log (on the server side)
I go and check my database in mLab and found that the index was not auto created
This is the first time I face such issue in parse.
Thanks !
The text was updated successfully, but these errors were encountered: