Date Tags

Date tags are placeholders for different date operations relative to when a query is run. Date tags make date fields easier to work with by saving you from having to perform calculations with the MongoDB Date() function. Studio 3T converts the date tags when the query is run into the appropriate MongoDB query, using greater than and…

Date tags are placeholders for different date operations relative to when a query is run. Date tags make date fields easier to work with by saving you from having to perform calculations with the MongoDB Date() function.

Studio 3T converts the date tags when the query is run into the appropriate MongoDB query, using greater than and less than operators to cover the calculated time range.

Studio 3T's date tags help you query MongoDB date fields by adding greater and less than operators to your MongoDB query

For example, in the screenshot above, the query

expands into

and the range is automatically updated when that query is run, to reflect the time and date of that run.

Where can Date tags be used?

You can use Date tags in the Collection tab’s Query bar, IntelliShell, Visual Query Builder, in the Aggregation editor when creating a $match stage, and in find and aggregation queries used in Exports.

Relative Date Tags

TagDefinition
Hour-related tags
#nextNhoursWithin the next N hours from now
#nexthourWithin the next hour
#lastNhoursWithin the last N hours up to now
#lasthourWithin the last hour
General past / future tags
#uptonowAny time before now (“in the past”)
#fromnowAny time from now (“in the future”)
#aftertodayAny time after today
#beforetodayAny time before today
Days-related tags
#todayAny time today
#yesterdayAny time yesterday
#tomorrowAny time tomorrow
#nextNdaysThe rest of today + the next N calendar days
#nextNcaldaysThe next N calendar days following today
#lastNdaysthe last N calendar days + the start of today until now
#lastNcaldaysThe last N calendar days before today
Weeks related tags
#nextNweeksThe rest of today + the next N weeks – equivalent to #nextN*7days
#nextNcalweeksThe next N calendar (Mon-Sun) weeks after the current calendar week
#nextweekThe next week – the rest of today plus the next 7 calendar days, equivalent to #next7days
#nextcalweekThe next calendar week following the current calendar week
#lastNweeksthe last N weeks + the start of today until now – equivalent to #lastN*7days
#lastNcalweeksThe last N calendar (Mon-Sun) weeks before the current calendar week
#lastweekThe last 7 calendar days + the start of today until now, equivalent to #last7days
#lastcalweekThe calendar week before the current calendar week
#thisweek
#thiscalweek
The current calendar week (Mon – Sun)
Months related tags
#nextNmonthsThe next N months from and including the rest of today
#nextNcalmonthsThe next N calendar months after the current month
#nextmonthThe next month from today including the rest of today – equivalent to #next1months
#nextcalmonthThe next calendar month following the current month
#lastNmonthsThe last N months up to and including the start of today until now
#lastNcalmonthsThe last N calendar months before the current month
#lastmonthThe last month leading up to and including the start of today until now – equivalent to #last1month
#lastcalmonthThe last calendar month before the current month
#thismonth
#thiscalmonth
The current calendar month
Years related tags
#nextNyearsThe next N years from now and including the rest of today
#nextNcalyearsThe next N calendar years after this year
#nextyearThe next year from now, including the rest of today – equivalent to #next1years
#nextcalyearThe next calendar year after this year
#lastNyearsThe last N years up to and including the start of today until now
#lastNcalyearsThe last N calendar years before this year
#lastyearThe last year up to and including the start of today until now – equivalent to #last1years
#lastcalyearThe last calendar year before this year
#thisyear
#thiscalyear
The current calendar year