Hello, I am working on my anon message board. My data structure in mongoose is as follows:
const boardSchema = new Schema({
thread: String,
dateCreated: {type: Date, default: Date.now},
notes: [{
note: String,
replies: [{note: String, date: {type: Date, default: Date.now} }]
}]
});
for each “board” (which will be a model or document) there are multiple threads and within each thread there are multiple notes and replies …
My question is how do I query based on Model?
if I create a model ‘bean’ and then later create model ‘tea’ by:
const bean = new Schema(‘bean’, boardSchema);
const tea = new Schema(‘tea’, boardSchema);
how do I later access each of these models with Model.update(…);
, keeping in mind that “bean” and “tea” are not kept in memory?