Заранее спасибо, почему я получаю пустой массив из Mongodb, даже если использую правильное имя схемы?
const Mongoose = require("mongoose");
const studentSchema = Mongoose.Schema({
_id: { type: Number, required: true },
name: { type: String, required: true, max: 30 },
department: { type: String, required: true,max: 30 },
type: { type: String, required: true, min: 7, max: 30 }
});
module.exports = Mongoose.model("StudentInformation", studentSchema);
-----------------------------------------------------------------------
class Service {
static get() {
const data = studentsModel.find({}).then((result) => {
console.log(studentsModel)
return result;
});
return data;
}
}
----------------------------------------------------------------------
```
> db.getCollectionNames();
[ "StudentInformation", "students" ]
> db.StudentInformation.find();
{ "_id" : 1, "name" : "selva", "department" : "CSE", "type" : "regular" }
{ "_id" : 2, "name" : "ashik", "department" : "CSE", "type" : "regular" }
{ "_id" : 3, "name" : "praveen", "department" : "CSE", "type" : "parttime" }