php - MongoDB - Count every record where timestamp <= yesterday -
--solved-- timestamp within quotation marks fix it!
i have mongodb instance running on ubuntu test bench. i'm doing harvesting tweets, generate statistics tweeting behavior in amsterdam. 1 of stats want visualize amount of tweets per day. every tweet has timestamp in milliseconds, guess can query on that, right?
unfortunately, query made doesn't generate expected outcome:
db.testtweets.count({ "timestamp_ms": { "$lte": 1464432361000 } });
the query above returns 0, expected return 196827 (all tweets in db till today). doing wrong? if change query is not null
below, returns count of tweets should.
db.testtweets.count({ "timestamp_ms": { "$ne": null } });
hope guys can me out make query counts every tweet below timestamp (for example yesterday: 1464354713000).
edit full document preview, try url: http://pastebin.com/fddpynx1
in document, value in seconds or milliseconds? timestamp - seconds, need send request without 000. try code:
db.testtweets.count({ "timestamp_ms": { "$lte": 1464432361 }});
Comments
Post a Comment