I don't know if this is even possible, I can see that there might be issues with using bash parameters in a mongo eval query. What I'm trying to do is to update documents in mongo where a value date is greater than todays date.
Example: Today's date is less(<) than tomorrows date, thus update field X of same document.
I've got the following, but I'm wondering how to pass the date variable to the mongo query. Is it even possible? Is there another way to Rome?
#!/bin/sh
today="$(date +'%Y-%m-%d')"
mongo db --eval 'db.Scheme.update({"FutureDate":{$gte: $today}},{$set:{"X":"$today"}});'
Alternately I've tried to switch $today with new Date().setHours(0,0,0,0) but are unable to perform the query.
Help or constructive feedback is much appreciated, thanks! :)
command 'previous'"$var"'next"