Hi,
Am newbie to MongoDB. Can you help me pull all the documents that were recorded in a collection yesterday dynamically?
Am trying this in MongoDB Compass, aggregation pipeline where am trying to retrieve all the documents that have date_added > yesterday and date_added < today (after truncating time).
I am a SQL developer and was looking for a equivalent query to pull yesterdays records:
SELECT * FROM t1
WHERE date_added > CONVERT(DATE, GetDate()-1)
AND date_added < CONVERT(DATE, GetDate())
Note: Please test your aggregation pipeline as per your requirements and collection documents. Also, try testing the edge cases of your use-cases to make sure you don’t miss anything.