Currently, my Mongo database contains JSON data structured like this:
{
"uSN": "100030001",
"timestamp": 1470009600,
"timetag": 1082016,
"monthtag": 82016,
"hourtag": 11,
"mintag": 10,
"yeartag": 2016,
"id": "d100030001_01082016_11_10"
},
{
"uSN": "100030001",
"timestamp": 1470096000,
"timetag": 2082016,
"monthtag": 82016,
"hourtag": 11,
"mintag": 10,
"yeartag": 2016,
"id": "d100030001_02082016_11_10"
},
{
"uSN": "100030001",
"timestamp": 1469850900,
"timetag": 30072016,
"monthtag": 72016,
"hourtag": 10,
"mintag": 55,
"yeartag": 2016,
"id": "d100030001_30072016_10_55"
},
{
"uSN": "100030001",
"timestamp": 1469923200,
"timetag": 31072016,
"monthtag": 72016,
"hourtag": 11,
"mintag": 10,
"yeartag": 2016,
"id": "d100030001_31072016_11_10"
},
{
"uSN": "100030001",
"timestamp": 1469577600,
"timetag": 27072016,
"monthtag": 72016,
"hourtag": 11,
"mintag": 10,
"yeartag": 2016,
"id": "d100030001_27072016_11_10"
}
I'm attempting to query the database from my mongo shell to retrieve data ranging from the 30th of July, 2016 to the 1st of August, 2016.
The queries I've tried so far are:
db.dataProfTable.find({ uSN: '100030001', timestamp : {'$gte': new Date(1469836800), '$lte': new Date(1470009600)})
and
db.dataProfTable.find({'uSN': '100030001', 'timetag': {$gte: '30072016', $lt: '01082016'}})
Unfortunately, these queries are not producing the desired results. How can I resolve this issue?