Reputation: 1360
I run a mongoexport query in order to get a .json file with my data.
Here is the working syntax :
mongoexport --host hostvalue --username usernamevalue --password passwordvalue --db dbvalue --collection projects --out file.json
But I want to filter the data that are generated. In order to do so, i add the following query :
mongoexport --query '{"ProductRange":"BUILDING_INSURANCE"}' --host hostvalue --username usernamevalue --password passwordvalue --db dbvalue --collection projects --out file.json
Of course I have an object in my collection who has the given property and value :
But with the query I have the following issue :
2020-02-25T11:12:23.980+0100 error validating settings: query '[39 123 80 114 111 100 117 99 116 82 97 110 103 101 58 66 85 73 76 68 73 78 71 95 73 78 83 85 82 65 78 67 69 125 39]' is not valid JSON: json: cannot unmarshal string into Go value of type map[string]interface {}
2020-02-25T11:12:23.985+0100 try 'mongoexport --help' for more information
I don't understand this issue and how to fix it. Following the query documentation for the 3.2 driver, I have the same syntax that the one required
Upvotes: 0
Views: 105
Reputation: 6809
There is difference when you run the query on windows or Linux w.r.t to quotes. On windows you need to surround the query with double quotes
mongoexport --query "{'ProductRange':'BUILDING_INSURANCE'}" --host hostvalue --username usernamevalue --password passwordvalue --db dbvalue --collection projects --out file.json
Upvotes: 1