[SERVER-3259] Using a date timestamp with mongo --eval yields zero results Created: 14/Jun/11 Updated: 29/Aug/11 Resolved: 15/Jun/11 |
|
| Status: | Closed |
| Project: | Core Server |
| Component/s: | Shell |
| Affects Version/s: | 1.8.1 |
| Fix Version/s: | None |
| Type: | Bug | Priority: | Minor - P4 |
| Reporter: | Ryan Felton | Assignee: | Scott Hernandez (Inactive) |
| Resolution: | Done | Votes: | 2 |
| Labels: | query | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Environment: |
Mac OSX 10.6.7 64 bit |
||
| Operating System: | ALL |
| Participants: |
| Description |
|
When running the query in the mongo shell, the query returns the proper result: mongo localhost:27017/development However, when performing the query via eval, the query always returns 0 results. mongo localhost:27017/development --eval "db.statistics.find({'type': 'Hourly', 'statistics_date' : {'$lt': new Date(1307145600000)}}).count();" |
| Comments |
| Comment by Scott Hernandez (Inactive) [ 15/Jun/11 ] |
|
closed |
| Comment by Ryan Felton [ 15/Jun/11 ] |
|
Yep, that worked.. Thanks! How do I close this ticket? |
| Comment by Scott Hernandez (Inactive) [ 14/Jun/11 ] |
|
The problem is the variable substitution from the shell (bash/sh) "$" which is being replaced. Try "db.statistics.find({'type': 'Hourly', 'statistics_date' : {'\$lt': new Date(1307145600000)}}).count();" |