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

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

java - Digest auth with Spring Security using javaconfig -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -