Minimize db query
This commit is contained in:
@@ -168,9 +168,7 @@ RestQuery.prototype.validateClientClassCreation = function() {
|
|||||||
let sysClass = ['_User', '_Installation', '_Role', '_Session', '_Product'];
|
let sysClass = ['_User', '_Installation', '_Role', '_Session', '_Product'];
|
||||||
if (this.config.allowClientClassCreation === false && !this.auth.isMaster
|
if (this.config.allowClientClassCreation === false && !this.auth.isMaster
|
||||||
&& sysClass.indexOf(this.className) === -1) {
|
&& sysClass.indexOf(this.className) === -1) {
|
||||||
return this.config.database.loadSchema().then((schema) => {
|
return this.config.database.collectionExists(this.className).then((hasClass) => {
|
||||||
return schema.hasClass(this.className)
|
|
||||||
}).then((hasClass) => {
|
|
||||||
if (hasClass === true) {
|
if (hasClass === true) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -112,9 +112,7 @@ RestWrite.prototype.validateClientClassCreation = function() {
|
|||||||
let sysClass = ['_User', '_Installation', '_Role', '_Session', '_Product'];
|
let sysClass = ['_User', '_Installation', '_Role', '_Session', '_Product'];
|
||||||
if (this.config.allowClientClassCreation === false && !this.auth.isMaster
|
if (this.config.allowClientClassCreation === false && !this.auth.isMaster
|
||||||
&& sysClass.indexOf(this.className) === -1) {
|
&& sysClass.indexOf(this.className) === -1) {
|
||||||
return this.config.database.loadSchema().then((schema) => {
|
return this.config.database.collectionExists(this.className).then((hasClass) => {
|
||||||
return schema.hasClass(this.className)
|
|
||||||
}).then((hasClass) => {
|
|
||||||
if (hasClass === true) {
|
if (hasClass === true) {
|
||||||
return Promise.resolve();
|
return Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user