Skip to content

Commit 7143a12

Browse files
committed
Merge pull request #919 from Marco129/minimize-query
Minimize db query
2 parents 0c446b9 + 2f63c55 commit 7143a12

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

src/RestQuery.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -168,9 +168,7 @@ RestQuery.prototype.validateClientClassCreation = function() {
168168
let sysClass = ['_User', '_Installation', '_Role', '_Session', '_Product'];
169169
if (this.config.allowClientClassCreation === false && !this.auth.isMaster
170170
&& sysClass.indexOf(this.className) === -1) {
171-
return this.config.database.loadSchema().then((schema) => {
172-
return schema.hasClass(this.className)
173-
}).then((hasClass) => {
171+
return this.config.database.collectionExists(this.className).then((hasClass) => {
174172
if (hasClass === true) {
175173
return Promise.resolve();
176174
}

src/RestWrite.js

+1-3
Original file line numberDiff line numberDiff line change
@@ -112,9 +112,7 @@ RestWrite.prototype.validateClientClassCreation = function() {
112112
let sysClass = ['_User', '_Installation', '_Role', '_Session', '_Product'];
113113
if (this.config.allowClientClassCreation === false && !this.auth.isMaster
114114
&& sysClass.indexOf(this.className) === -1) {
115-
return this.config.database.loadSchema().then((schema) => {
116-
return schema.hasClass(this.className)
117-
}).then((hasClass) => {
115+
return this.config.database.collectionExists(this.className).then((hasClass) => {
118116
if (hasClass === true) {
119117
return Promise.resolve();
120118
}

0 commit comments

Comments
 (0)