私はNodeJs + MongoDB(Mongoose)の学習を始めました。 クエリに問題があります。今月の誕生日を持つすべてのユーザーを選択してください
私はが必要です今月の誕生日を持つすべてのユーザーを選択してください。
ユーザーのスキーマ:コレクションの
const UserSchema = new mongoose.Schema({
email: {
type: String,
unique: true,
required: true,
index: true
},
password: {
type: String,
required: true
},
firstName: {
type: String,
required: true
},
lastName: {
type: String,
required: true
},
phone: {
type: String,
required: true
},
birthday: {
type: Date,
required: true
},
photo: {
type: String,
required: false
},
updated: {
type: Date,
default: Date.now
}
});
例(ユーザー)文書:
{
"__v" : NumberInt(0),
"_id" : ObjectId("589b26ab4490e29ab5bdc17c"),
"birthday" : ISODate("1982-08-17T00:00:00.000+0000"),
"email" : "[email protected]",
"firstName" : "John",
"lastName" : "Smith",
"password" : "$2a$10$/NvuIGgAYbFIFMMFW1RbBuRGvIFa2bOUQGMrCPRWV7BJtrU71PF6W",
"phone" : "1234567890",
"photo" : "photo-1486565456205.jpg",
"updated" : ISODate("2017-02-08T14:09:47.215+0000")
}
重複。この質問をチェックアウト:[回答1](http://stackoverflow.com/questions/34614042/how-to-get-list-of-users-whos-birthday-is-today-in-mongodb) – ZombieChowder