I want to build a http://producthunt.com clone with node.js. The links are stored in MongoDB (I use mongoose).
Now I want to write a method, which gets a date and outputs all objects, created on that Date. The Date is in the following format: "created" : ISODate("2014-07-15T13:01:31.748Z")
I don't know how to handle with this format. I really tried a lot. I don't want you to make my job. Here is an example for the code for requesting any links.
Link
.find()
.exec(function(err, data) {
if (err)
res.send(err);
res.json(data);
For example I made it work that I "find" all Links, and just pick the link of the requested day. But I want to build that mongoose handles these Date, but it seems that it is not supported by this Date-Format. Something like that:
var requestedDate = req.params.date;
Link
.find({created: requestedDate})
.exec(function(err, data) {
if (err)
res.send(err);
res.json(data);
});
I think the problem is that I don't need a Date, but a Date-range.