0

I have a service who is all the time getting data from different sources. Then, it have to check if this data exists in database and if exists update the data, else if not exist insert the data.

The data in data base may be large (thousands of elements) and in this moment I'm doing one select in each element I got with the service against the data base to check if the element exists. I have a lot of selects all the time and I think this is not the best way to maintain my master data. What do you think? What should be the best strategy to do this?

(I use .Net C# and MongoDB)

Thanks, Dani.

Daniel
  • 148
  • 1
  • 12
  • 1
    Thousands is not a lot for a database. I deal with tables that have tens if not hundreds of millions of rows. How often are you updating and checking? – Jeff Watkins Sep 08 '15 at 08:22
  • You can look at this link to perform upserts: http://stackoverflow.com/questions/30082599/how-to-do-an-upsert-with-mongodb-2-0 –  Sep 08 '15 at 11:57
  • I know thousands is not a lot for a database, english is not my native language and I have some difficulties to express my doubt... I would like to say that in the table (or collection in Mongo), there are thousands of records(maybe a lot is not the correct adjective) to expose my situation. My question is given by checking/updating frequency, which is very high, continuously. – Daniel Sep 08 '15 at 14:46

0 Answers0