I need to be able to search for dates and numbers in arrays
I have sets of results which contain dates and I need to be able to search from within them. For example:
{
experience: [
{ name: "Abc", startDate: ISODate("2019-01-01T00:00:00.000Z"), startDate: ISODate("2020-01-01T00:00:00.000Z") },
{ name: "Xyz", startDate: ISODate("2018-01-01T00:00:00.000Z"), startDate: ISODate("2019-01-01T00:00:00.000Z") }
]
}
So I need to be able to do a near
search across experience.startDate
values, for example.
The Date mapping documentation (https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/#date) says:
A date cannot be indexed if it is part of an array.
And while the number documentation doesn't mention the same restriction by experimentation I have found it has the same resriction (strings dont however). Essentially this feature request is to remove this restriction for dates and numbers.
Complete, view changelog for more information
-
AdminRuchir Mehta (Admin, MongoDB) commented
Hi All, I’m reaching out because this feature will be available for early access soon. If you’d like early access to this feature please review and respond to the email I sent today by EOD Friday, Sept 2nd and we’ll schedule you to receive access during the week of September 19th. Please keep in mind that delivery of this feature requires a reindexing of your collections - the email I sent has more details on what that entails and some additional information. Thanks!
-
Sukhmeet commented
+1 for Boolean support.
-
Manuel commented
I found the problem to exist also for Boolean values inside an array object. I need it for filters during $search.