Skip to content

Commit 4ee9cb7

Browse files
committed
Fix for related query on non-existing column
1 parent b3a52fb commit 4ee9cb7

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

spec/ParseRole.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,5 +119,25 @@ describe('Parse Role testing', () => {
119119
});
120120
});
121121

122+
it('can create role and query empty users', (done)=> {
123+
var roleACL = new Parse.ACL();
124+
roleACL.setPublicReadAccess(true);
125+
var role = new Parse.Role('subscribers', roleACL);
126+
role.save({}, {useMasterKey : true})
127+
.then((x)=>{
128+
var query = role.relation('users').query();
129+
query.find({useMasterKey : true})
130+
.then((users)=>{
131+
done();
132+
}, (e)=>{
133+
fail('should not have errors');
134+
done();
135+
});
136+
}, (e) => {
137+
console.log(e);
138+
fail('should not have errored');
139+
});
140+
});
141+
122142
});
123143

src/Controllers/DatabaseController.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ DatabaseController.prototype.loadSchema = function(acceptor = returnsTrue) {
8989
DatabaseController.prototype.redirectClassNameForKey = function(className, key) {
9090
return this.loadSchema().then((schema) => {
9191
var t = schema.getExpectedType(className, key);
92-
var match = t.match(/^relation<(.*)>$/);
92+
var match = t ? t.match(/^relation<(.*)>$/) : false;
9393
if (match) {
9494
return match[1];
9595
} else {

0 commit comments

Comments
 (0)