0

I have two collections The structure of collection one is

{'click_id':"123345",
...
}

The structure of collection two is

{'click_id':"123345",
...

}

What is the optimal way to do the following in collection 1

{'click_id':"123345",
'collection2':true,
...
    }

considering the fact there are around 1 billion records in collection 1 and around 30 million records in collection 2.

Abhinav Kumar
  • 301
  • 1
  • 3
  • 13

1 Answers1

0

As far as I know you can't do stuff like JOIN from SQL DBs on MongoDB.

If your job is batch and you can think of the second collection as of a state snapshot, you could just load all the 30 million IDs into memory (should be under 1 GB, but it depends on the length of the IDs) as dictionary/map.

Then go through all the 1 billion records from the 1st collection and save the results in Bulk insert/update (IDK what you want).

pkopac
  • 986
  • 1
  • 13
  • 21