1

I am running the following query in a bash script, giving the error E QUERY SyntaxError: Unexpected token ILLEGAL

mongo $MONGO_DATABASE --eval "printjson(db.mycollection.find({\"created_at\" : { \"$""lte\" : ISODate(2016-04-"$i"T09:26:31.190Z) }}).toArray())"

Any help would be appreciated.

1 Answer 1

1

You forgot double quote inside ISODate : ISODate(\"2016-04-"$i"T09:26:31.190Z\") :

mongo $MONGO_DATABASE --eval "printjson(db.mycollection.find({\"created_at\" : { \"$""lte\" : ISODate(\"2016-04-"$i"T09:26:31.190Z\")}}).toArray())"
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.