How to sort the different date formats in MongoDB? I need to sort the date which is in the format of ’22-Mar-2012′.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
MongoDB native date type allows sorting naturally. If you’re using is, you should have no issue, otherwise I’d suggest you migrate your current data to use this format. See http://www.mongodb.org/display/DOCS/Dates for more on the subject.