I have a schema that has some properties and array of objects as one of the properties, like that:
const Project = mongoose.Schema({
_id: String,
name: String,
comments:[String]
date: Date,
tests:[{
description: String,
comments:[String]
}]
});
i want to be able to filter all documents that contains some string.
The query should be searching for the string inside the 'name' field of 'Project' schema and inside the tests objects in their description field. and return all the documents that contains the string (in project name or in one of his test description)
1.what query should I use to do so?
2.same question but with filtering both schema and tests comments field in addition to description