How to query birthday is today

I need to get all users those who have birthday today

Here is my code
var user = Parse.Object.extend("_User");
var query = new Parse.Query(user);
query.equalTo(“birthday”,new Date());
query.find().then(function(results) {

}

query.greaterThan(yesterday);
query.lessThan(tomorrow);

This should work

Problem is the year. How can we query a date object without year. My date of birth is ‘01-01-1991’ and i’m querying 2021.

Ah you are right. You can use aggregation. Or you can store the birth day and month in a string field. And directly query against that field.

user = {
 birthDay: "06-11" // Birthday is 6th of November.
}
const today = new Date();
query.equalTo("birthDay",`${today.getDate()}-${today.getMonth() + 1}`);

Birthday is already stored as date. Can you tell me how to use the aggregation.

this is what I found on google

Thank you for posting it here. It brightened my day, especially since it’s my birthday, making this thread a delightful birthday present for me.