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.
![](https://secure.gravatar.com/avatar/070a67698f6bfacec3059b8fa2051007?size=40&default=https%3A%2F%2Fassets.uvcdn.com%2Fpkg%2Fadmin%2Ficons%2Fuser_70-6bcf9e08938533adb9bac95c3e487cb2a6d4a32f890ca6fdc82e3072e0ea0368.png)
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.