I receive current day transactional data which I dump into a collection called 'collA'. The data will be reportable for max of 4 days, after this the data becomes useless to me.

Are the below two possible in mongoDB?

  1. Auto swap collections - when clock turns 12 AM, create new collection. At this point the old collection should be renamed to 'collA1'. So at the end of day 4, I'll be having collA, collA1, collA2, collA3 and collA4

  2. WRITE queries should be directed only to the new collection collA

  3. Read queries should be directed to all collA1 - 4 and collA

  • What is the MongoDB version (x,y,z)? – Md Haidar Ali Khan Aug 18 at 3:23
  • I'm using mongodb version 4.0.9 – Anban Aug 19 at 2:33

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.