I have a bash variable $i which has to be embed in mongo shell query to get the data by comparing date.
i=10
while [ "$i" -lt 12 ]; do
mongo $MONGO_DATABASE --eval 'printjson(db.mycollection.find({"created_at":{"$lte":ISODate(2016-04-\"$i\"T09:26:31.190Z)}}).toArray())' > $OUTPUT_DIRECTORY/$FILE_NAME
done
The above implementation is giving i: command not found