I am not able to pass a query parameter to mongoexport

83 Views Asked by At

when I try export from MongoDB only specific record (specified by query {'Deleted':false}) I got mentioned error:

mongoexport -d=AAA-Master -c='CMD.File' -q="{'Deleted':false}" --out cnt_file.json

2023-02-27T12:42:47.424+0100 connected to: mongodb://localhost/

2023-02-27T12:42:47.435+0100 Failed: error parsing query as Extended JSON: invalid JSON input

Platform is Windows 11, MongoDB version 4.4.18.

I also tried it this way -q='{"Deleted":false}' - with the same result.

Why?
According to the documentation seems be all correct.

1

There are 1 best solutions below

0
LDonSOvrfw On

I found it. The way how write the query is: -q="{\"Name\":\"0100\",\"Deleted\":false}"

Here is more: Mongodump –query not able to filter using timestamp