I am trying to search in the array, with the range date but it is not working. if I try searching alone in the array it is not working too. though I check I have data according to the search query.
this is my sample data -
{
"_id" : ObjectId("6401bf4640e29af1625c10a9"),
"articleid" : "165097155",
"headline" : "iOS vs. Android: Android Must Consider these iOS Features"
"article_type" : "online",
"pubdateRange" : ISODate("2023-03-03T14:55:01.000+0000"),
"clientidArray" : [ "M0036", "Y0010", "D0382"]
}
The index name is - fulltext, where the headline is indexed as a string, pubdateRange as Date, and clientidArray as a string too
The query I am trying to execute is -
db.getCollection("article_beta").aggregate([
{
"$search":{
"index":"fulltext",
"compound":{
"must":[
{
"range":{
"path":"pubdateRange",
"gte":"ISODate(""2023-01-01T00:00:00.000Z"")",
"lte":"ISODate(""2023-03-15T00:00:00.000Z"")"
}
},
{
"text":{
"query":"D0382",
"path":[
"clientidArray"
]
}
}
]
}
}
}
])
Any help is much appreciated.