I have this piece of code that runs fine on my computer but it fails in production :
let today = new Date()
let users = Meteor.users.find({
"status.lastLogin": { $not: { $eq: null } },
$expr: {
$and: [
{
$eq: [
{
$dayOfMonth: {
date: "$profile.birthdate",
timezone: "Europe/Paris",
},
},
today.getDate(),
],
},
{
$eq: [
{
$month: {
date: "$profile.birthdate",
timezone: "Europe/Paris",
},
},
today.getMonth() + 1,
],
},
],
},
})
My server is hosted on Galaxy and the DB on mongodb.com
I checked the profile.birthdate type and it is Date on mongodb.com
The error is :
MongoError: can’t convert from BSON type string to Date\n at Connection. (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/pool.js:450:61)\n at Connection.emit (events.js:311:20)\n at Connection.EventEmitter.emit (domain.js:482:12)\n at processMessage (/app/bundle/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/mongodb/lib/core/connection/connection.js:384:10)\n at TLSSocket.
Does anyone know why this is happening and how can I fix it?