I am new to shell scripting. Actually I am writing a shell script for mongo to find specific document, this shell script accepts an argument and uses in find. I had written a simple find query:
mongo poc --eval "printjson(db.users.find().toArray())"
That's working fine, but now problem is that when I want to find specific document by passing users id that gives null records, so here is my shell script:
mongo poc --eval "printjson(db.users.find({"userid":"$1"}).toArray())"
I don't know what is wrong, please help so that i would be able to write for update and remove query as well.