1
    "_id" : ObjectId("5713af5e39dd161a0c546501"),
    "year" : "1949",
    "_created_at" : ISODate("2016-04-17T15:44:30.221Z"),
    "_updated_at" : ISODate("2016-04-17T15:44:30.221Z"),
    "date" : "10.1" // 10 is day 1 is the month

I have my collection called quotes with the structure above.

In the express app I want to get all the data for each month. I tried this but it didn't work:

mongoose.model('quotes').find({ date: { $search : id  } },function (err, quotes) {
    if (err) {
      return console.error(err);
    } else {
      //respond to both HTML and JSON. JSON responses require 'Accept: application/json;' in the Request Header
      res.send(quotes);
    }
});

id here is the month; like, if it is 1 that means it is January. I get no response back when executing the code.

Thanks for your help

Özgür Ersil
  • 6,909
  • 3
  • 19
  • 29

0 Answers0