Skip to content

Commit a380fcf

Browse files
dplewisflovilmart
authored andcommitted
fix(postgres): Geopoint issue #3285 (#3874)
1 parent d149d16 commit a380fcf

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

spec/ParseGeoPoint.spec.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,25 @@ describe('Parse.GeoPoint testing', () => {
2626
});
2727
});
2828

29+
it('update geopoint', (done) => {
30+
const oldPoint = new Parse.GeoPoint(44.0, -11.0);
31+
const newPoint = new Parse.GeoPoint(24.0, 19.0);
32+
const obj = new TestObject();
33+
obj.set('location', oldPoint);
34+
obj.save().then(() => {
35+
obj.set('location', newPoint);
36+
return obj.save();
37+
}).then(() => {
38+
var query = new Parse.Query(TestObject);
39+
return query.get(obj.id);
40+
}).then((result) => {
41+
const point = result.get('location');
42+
equal(point.latitude, newPoint.latitude);
43+
equal(point.longitude, newPoint.longitude);
44+
done();
45+
});
46+
});
47+
2948
it('has the correct __type field in the json response', done => {
3049
var point = new Parse.GeoPoint(44.0, -11.0);
3150
var obj = new TestObject();

src/Adapters/Storage/Postgres/PostgresStorageAdapter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -920,7 +920,7 @@ export class PostgresStorageAdapter {
920920
index += 2;
921921
} else if (fieldValue.__type === 'GeoPoint') {
922922
updatePatterns.push(`$${index}:name = POINT($${index + 1}, $${index + 2})`);
923-
values.push(fieldName, fieldValue.latitude, fieldValue.longitude);
923+
values.push(fieldName, fieldValue.longitude, fieldValue.latitude);
924924
index += 3;
925925
} else if (fieldValue.__type === 'Relation') {
926926
// noop

0 commit comments

Comments
 (0)