Skip to content

Commit 93c0538

Browse files
authored
Support query exclude keys (#857)
* Support query exclude keys * nit wording * update parse-server master branch * Fix tests
1 parent 3116f67 commit 93c0538

File tree

7 files changed

+937
-350
lines changed

7 files changed

+937
-350
lines changed

integration/test/ParseGeoPointTest.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ const Parse = require('../../node');
66

77
const TestObject = Parse.Object.extend('TestObject');
88
const TestPoint = Parse.Object.extend('TestPoint');
9+
const Container = Parse.Object.extend('Container');
910

1011
describe('Geo Point', () => {
1112
beforeAll((done) => {
@@ -50,7 +51,7 @@ describe('Geo Point', () => {
5051

5152
it('can only store one geo point per object', (done) => {
5253
const point = new Parse.GeoPoint(20, 20);
53-
const obj = new TestObject();
54+
const obj = new Container();
5455
obj.set('locationOne', point);
5556
obj.set('locationTwo', point);
5657
obj.save().then(done.fail).catch(() => {

integration/test/ParseQueryTest.js

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1189,6 +1189,38 @@ describe('Parse Query', () => {
11891189
});
11901190
});
11911191

1192+
it('can exclude keys', async () => {
1193+
const object = new TestObject({
1194+
hello: 'world',
1195+
foo: 'bar',
1196+
slice: 'pizza',
1197+
});
1198+
await object.save();
1199+
1200+
const query = new Parse.Query(TestObject);
1201+
query.exclude('foo');
1202+
const result = await query.get(object.id);
1203+
assert.equal(result.get('foo'), undefined);
1204+
assert.equal(result.get('hello'), 'world');
1205+
assert.equal(result.get('slice'), 'pizza');
1206+
});
1207+
1208+
it('can exclude multiple keys', async () => {
1209+
const object = new TestObject({
1210+
hello: 'world',
1211+
foo: 'bar',
1212+
slice: 'pizza',
1213+
});
1214+
await object.save();
1215+
1216+
const query = new Parse.Query(TestObject);
1217+
query.exclude(['foo', 'hello']);
1218+
const result = await query.get(object.id);
1219+
assert.equal(result.get('foo'), undefined);
1220+
assert.equal(result.get('hello'), undefined);
1221+
assert.equal(result.get('slice'), 'pizza');
1222+
});
1223+
11921224
it('uses subclasses when creating objects', (done) => {
11931225
const ParentObject = Parse.Object.extend({ className: 'ParentObject' });
11941226
let ChildObject = Parse.Object.extend('ChildObject', {

integration/test/ParseUserTest.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -536,6 +536,7 @@ describe('Parse User', () => {
536536
Parse.User.enableUnsafeCurrentUser();
537537

538538
await Parse.User.signUp('foobaz', '1234');
539+
await Parse.User.logOut();
539540

540541
const user = await Parse.AnonymousUtils.logIn();
541542
user.set('field', 'hello world');

0 commit comments

Comments
 (0)