Mongodb query specific month|year not date
问题 How can I query a specific month in mongodb, not date range, I need month to make a list of customer birthday for current month. In SQL will be something like that: SELECT * FROM customer WHERE MONTH(bday)=\'09\' Now I need to translate that in mongodb. Note: My dates are already saved in MongoDate type, I used this thinking that will be easy to work before but now I can\'t find easily how to do this simple thing. 回答1: You can do that using aggregate with the $month projection operator: db