0

When doing the following it works fine:

local$ ssh remote

remote$ mongo mydb --eval 'printjson(db.test.find({value : {$regex: "string"}},{name:1,_id:0}).toArray())'

However, if I try to do the following:

local$ ssh remote "mongo mydb --eval 'printjson(db.test.find({value : {$regex: "string"}},{name:1,_id:0}).toArray())'"

I get this error:

TokuMX mongo shell v2.0.0-mongodb-2.4.10
connecting to: mydb
Thu Apr 21 11:31:03.916 SyntaxError: Unexpected token :

What am I missing here? I know it must be something with escaping or enclosing special chars, but I couldn't figure out how to do it properly. Your help will be greatly appreciated.

Thanks!

TuxSax
  • 1,045
  • 2
  • 8
  • 12

0 Answers0