fix: Collection names were incorrect

This commit is contained in:
buzz-lightsnack-2007 2025-04-07 21:15:12 +08:00
parent f6ec954c6f
commit 5fa9e6efd6
2 changed files with 7 additions and 3 deletions

View file

@ -26,7 +26,9 @@ class DBManagement {
configure (COLLECTION, SCHEMA) {
this[`schema`] = new Mongoose.Schema(SCHEMA);
this[`collection`] = COLLECTION;
this.state.then(() => {this.model = this[`connection`].model(`URL`, this[`schema`]);})
this.state.then(() => {
this.model = this[`connection`].model(this[`collection`], this[`schema`]);
})
}
/*
@ -40,7 +42,7 @@ class DBManagement {
await this.state;
let RESULT = [];
if ((CRITERIA && CRITERIA instanceof Object) ? !Object.keys(CRITERIA).length : true) {
if ((CRITERIA && CRITERIA instanceof Object) ? !(Object.keys(CRITERIA).length) : true) {
RESULT = await this.model.find();
} else if (CRITERIA instanceof Object) {
RESULT = await this.model.find(CRITERIA);

View file

@ -54,3 +54,5 @@ class UsersManagement extends DBManagement {
};
};
}
module.exports = UsersManagement;