Thanks @Pavel_Duchovny. I’ll be going with adding the field in the first stage itself.
Regarding the indexing, I did have { field1: 1, ts : 1}
in the beginning, but then faced few issues like this Match regex is not utilizing index correctly - Working with Data - MongoDB Developer Community Forums
Also, with this index, I didnt have to create a separate index on field1
, query explain showed mongodb was reusing the existing index with min and max value on ts
.