I created the following schema :
const videoSchema = createSchema(
link: Type.string({required: true}),
description: Type.string({required: true}),
answers: Type.array({required: true}).of({
text: Type.string(),
likes: Type.number()
})
);
export const videoModel = typedModel('video', videoSchema);
Now I want to write a query that only has videos with over 200 likes as a result. I've tried to work with .aggregate, $reduce and $sum, but I can't get it to work.
Does anyone know how to achieve this ? Thank you in advance!