I'm building a database, I'm trying to put all the rows and columns in one collection named(Task) to make it easier to search for them later, but it doesn't work.
when I write {Sector: String} Next to {Name: String} It doesn't work, He forces me to make another collection. How can solve this problem?
<!--ejs file:-->
<!--add a task-->
<form action="/create" method="POST">
<input type="text" name="Name">
<button type="submit" class="btn btn-link">Link</button>
</form><br>
<!--JS file:-->
app.set("view engine", "ejs");
app.use(express.urlencoded({extended: true}));
mongoose.connect('mongodb://localhost:27017/Investors');
const schema = new mongoose.Schema({Name: String});
const Task = mongoose.model("Task", schema);
//insert
app.post("/create", (req, res) => {
const firstTask = new Task({Name: req.body.Name});
firstTask.save().then(() => res.redirect("/"));
});