skip to Main Content

In Mongodb, Mongoexport for collection is working on windows but when use –query getting the below error
Failed: error parsing query as Extended JSON: invalid JSON input

–query="{‘CreatedOnUtc’ : { ‘$gt’ : ISODate(‘2021-04-22T08:36:28.869Z’)}}"

2

Answers


  1. Provides a query as a JSON document (enclosed in quotes) to return matching documents in the export.

    You must enclose the query document in single quotes (‘{ … }’) to
    ensure that it does not interact with your shell environment.

    As per the documentation

    Swap the single and double quotes in your query field.

    For ex.

    -q='{ "a": { "$gte": 3 }, "date": { "$lt": { "$date": "2016-01-01T00:00:00.000Z" } } }'
    
    Login or Signup to reply.
  2. I think the quotes are inverted, try the following

    --query='{"CreatedOnUtc":{"$gt":ISODate("2021-04-22T08:36:28.869Z")}}'
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search