I have a full US city-data collection with latitude and longitude coordinates…
I also have over 1.5 million address records for customers. I need to use the combination of city/state as a key and upsert the longitude, latitude data into my geo field for the associated customer city/state.
Structured data sets… relatively easy, but I’m new to unstructured… They are on the same cluster in different databases… I get that I need to have the collections in the same DB (seems silly to not be able to merge data from different DBs, but). I just don’t know how to upsert from many to many in Mongo. Appreciate any help.
My Customer collection has a number of fields but has the object ‘address’ with the same data (city, region), but it has a NULL geo field… I need to update the geo field in the customer data with the geo object data from the city_geo collection by matching the ‘address’ object. This city_geo is an aggregation of the original city_data (with 43 string fields) into a same database output to the same DB as the customer data collection as city_geo with the 2 objects above.
OMGoodness… My notification didn’t come across. I jjust checked this.
Steeve, you are the man. That is exactly the push I needed… I’ve just been sitting here with FOTU (fear of the unknown).
I reverted this to a mongosh js file, but followed the same pattern. Like a charm and it completed in 36 minutes. AND… fantastic call on the unique index. what a difference that made.