[SERVER-4261] mongoexport query doesn't support advanced queries Created: 11/Nov/11 Updated: 06/Dec/14 Resolved: 22/Jun/12 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Tools |
| Affects Version/s: | 2.0.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Trivial - P5 |
| Reporter: | David Dunlop | Assignee: | Unassigned |
| Resolution: | Done | Votes: | 2 |
| Labels: | neweng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Backwards Compatibility: | Fully Compatible |
| Operating System: | Linux |
| Participants: |
| Description |
|
When I try and do a mongoexport using an an advanced query, I get 0 records even if there are matching objects. mongoexport --csv -h localhost -d contents -c Author -q "{'facebookName':{'$ne':null}}" -f profileUrl,facebookName I tried a few of the other dollar operators such as $in and $nin and they all appear to have the same result. |
| Comments |
| Comment by Yoft [ 06/Dec/14 ] | |
|
I'm facing this error with : mongoexport --db fscrap --collection Wall -q "{\$or : [{'insert_time' : {\$gte : new Date(1393624800000)} },{'comments.comment_time' : {\$gte : new Date(1393624800000)}}]}" --out test.json even with escaping I'm getting zero records while the query WORKS in mongo shell | |
| Comment by Dwight Merriman [ 22/Jun/12 ] | |
|
you need to escape the $ character in some shells. $ echo "{'facebookName':{'$ne':null}}" | |
| Comment by Erick Ruiz de Chavez [ 29/May/12 ] | |
|
I am having problems with a big query, same one worked perfectly on the Linux server. Command
Windows output Tue May 29 16:29:07 [ReplicaSetMonitorWatcher] starting Linux output Tue May 29 11:28:34 [ReplicaSetMonitorWatcher] starting | |
| Comment by Colin Marc [ 07/Feb/12 ] | |
|
I'm also having the same issue: exported 0 records. I tried with a very simple $or (always returns everything on the command line). $ /opt/mongodb/bin/mongoexport -vvvvvvv -h localhost:30000 -d lumberjack -c aggregates -q "{'$or': [{}]}" --csv -f s,c -o export.csv | |
| Comment by Bob McClellan Jr [ 10/Jan/12 ] | |
|
I also am having the same issue: $ mongoexport --db forms_prod --collection form_templates --out autism_forms.json --query "{ study_ids : { '$in' : ["6"], '$nin' : ["2"] } }" I do a find inside of the mongo shell using the exact same query statement and it returns fine. |