Mongodb - query - i need to fetch last 5 days data from given collection , i need help or assistance

#1

MongoDB - query - i need to fetch last 5 days data from given collection, i need help or assistance

I am trying to fetch data from the mongo table - where I need to give a clause where I cant fetch the last 7 days data.

date column in string format

image

0 Likes

#2

Hi,
this is tough, but you could use a regular expression, maybe. The query has to look something like that, then: {date: {$regex: "(11|10|09|08|07)-09-2019"}}. I am not sure if our version of Jongo supports it, but please try it and let me know of any problems you encounter!
Kind regards
Alexander

0 Likes