Hi all,
I am trying to schedule backups on a time series collection and I want to do hourly backups of the last hour of data. On top of daily full backups, I would like to schedule a backup every hour of the past hour of data (ie at 3pm, create a dump for data from 2pm-3pm).
I am trying to set up my shell script as such:
EPOCH_DATE=$(date '+%s%3N')
for COLLECTION in "${COLLECTIONS[@]}"
do
mongodump \
--db=database\
--collection=$COLLECTION \
--query="{ \"createdOn\": { \"\$gte\": {\"\$date\": $EPOCH_DATE} } }"
--out=/dir/backup/
done
But I am getting the following error:
Failed: cannot process query [{createdOn [{$gte 1670480228792}]}] for timeseries collection database.collection mongodump only processes queries on metadata fields for timeseries collections.
Is there a better way of achieving the goal of doing scheduled backups? Or should I change the way I structure my script?
Appreciate any help on the matter!