Description
New Issue Checklist
- I am not disclosing a vulnerability.
- I am not just asking a question.
- I have searched through existing issues.
- I can reproduce the issue with the latest version of Parse Server.
Issue Description
I want to retrieve object only in a specific radius of the user current Position.
I use Live Query to get when object enter, update, leave theses conditions in real time.
However when i write a query with withinKilometers / withinMiles / withinRadians the Live Query never triggered when the Object has his GeoPoint enter / update / leave the specific radius.
Steps to reproduce
- Setup a parse-server with Live Query
- Create a class with a GeoPoint column (in my example, my column is "location")
- Create a client, i tried on Parse Flutter SDK and Parse Javascript SDK
- Connect the client, make a Parse Query with a subscription based on withinKilometers / withinMiles / withinRadians conditions
My javascript example :
<html>
<head>
<meta charset="utf-8">
<title>Test</title>
<script src="https://unpkg.com/parse/dist/parse.js"></script>
<script>
main();
async function main() {
Parse.initialize("xxxxxxxxxxxxx");
Parse.serverURL = 'http://192.168.X.X:1337/parse'
var query = new Parse.Query('TestObject');
query.withinKilometers("location", new Parse.GeoPoint({latitude: 45, longitude: 2}), 1, false);
var subscription = await query.subscribe();
subscription.on('open', () => {
console.log('subscription opened');
});
subscription.on('update', (object) => {
console.log(object);
console.log('object updated');
});
subscription.on('enter', (object) => {
console.log(object);
console.log('enter updated');
});
subscription.on('leave', (object) => {
console.log(object);
console.log('object left');
});
subscription.on('delete', (object) => {
console.log(object);
console.log('object deleted');
});
subscription.on('close', () => {
console.log('subscription closed');
});
}
</script>
</head>
<body>
<p>Test</p>
</body>
</html>
Actual Outcome
My Live Query subscription is never triggered when the GeoPoint respect the subscription conditions.
If i replace the .subscription() by .find() the query worked fine, but this is not i want cause i need Live Query
Expected Outcome
I expect to get my TestObject
when his location is update and still respect my subscription condition.
In my example : a TestObject
with "location" Parse.GeoPoint({latitude: 45, longitude: 2})
must be return to client because the client have the same position and the withinKilometers is respected.
(see my example line query.withinKilometers("location", new Parse.GeoPoint({latitude: 45, longitude: 2}), 1, false);
)
Failing Test Case / Pull Request
- 🤩 I submitted a PR with a fix and a test case.
- 🧐 I submitted a PR with a failing test case.
Environment
Server
- Parse Server version:
4.5.0
- Operating system:
Windows 10.0.19043
- Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc):
local
Database
- System (MongoDB or Postgres):
MongoDB
- Database version:
4.4.4
- Local or remote host (MongoDB Atlas, mLab, AWS, Azure, Google Cloud, etc):
Local
Clients
- SDK JavaScript version:
3.3.0
- SDK Flutter version:
3.1.0
Logs
No log
Regards !