Mongoose.js find yesterday's date in database
<p>I want to find all the users created up until yesterday. This is my code to make the query string: </p>

<pre><code>var today = new Date();
var a = today.getDate();
a--;
today.setDate(a);
var yesterday = today.toDateString();
</code></pre>

<p>and it returns something like: Sun Jan 17 2016... which IS yesterday's date, but the db stores the date in iso format like: <code>"date" : ISODate("2016-01-13T13:23:08.419Z")</code> so what I get is <code>2016-01-13T13:23:08.419Z</code>. My problem now is that I can't use the yesterday variable to query the db for the users I need AND even if I could, I don't know how to find every registration not including the ones that took place today. </p>

<p>Any help? Thank you very much!</p>