I have db-survey and collection-details. On the terminal when I write-
(echo "use survey"; echo "db.details.find({age:10})") | mongo > age_ten.txt
It gives information of people whose age is 10 in age_ten.txt file.
But when I write-
(echo "use survey"; echo "db.details.find({age:{$gt:60}})") | mongo > medical.txt
It creates the file medical.txt but it has the error -
[js] SyntaxError: invalid property id @(shell):1:22
Funnily when I write - db.details.find({age:{$gt:60}} in mongo enviornment.It gives me the result that I want.
Can someone please explain me what I am doing wrong? Thanks in advance.