Atlas search to provide the ability to query number (long/double) fields
When querying mongo using atlas search, today it requires that the query parameter be a string. Ideally, I would like to be able to also search using numbers. Our stakeholders want the ability to type into a dropdown select field , type a number, and have it pull back a list of data.
Today, we are using atlas search to query against a multiple set of fields, and pull back the most relevant results. It would be nice to include number fields as part of our index in order to allow those same stakeholder the ability to query by the known number identifiers for that dataset with fuzzy / autocomplete.
Hey Marcus, thanks for the quick response on this.
I had ran into the number data type while reading through the documentation as well. Unfortunately, we do specifically want the ability to query using the fuzziness , and the ‘auto-complete’ / type-ahead feature that autocomplete provides. And I don’t -believe- (I could be wrong here), that querying numbers allows for those same features.
Regarding the idea regarding creating an additional field in mongo for storing the 'string'-ified version of the number, this has come up as an option internally as well, and it may be what we do in the short term, but obviously this is not ideal, since we will now need to maintain an additional field whenever we are doing updates/inserts, etc.
Appreciate your responses, and look forward to working with you some more in the future!
Today, you can create a field of type number. We actually support large integers (int64) and doubles (indexDoubles boolean).
You can learn about it here: https://docs.atlas.mongodb.com/reference/atlas-search/index-definitions/#number
Fuzzy and autocomplete are text operator options for the string type, so you would need to convert the type / cast it to a string in a copied field. You can do all of these operations in Atlas as well, if need be.