0

今日から3日後に誕生日が来るユーザーを見つけたい。

このユーザーを管理者に見せたいからです。

ここではmongoDbデータベースを使用しており、次のようなことを試しました:

@users = User.all
@users.each do |user|
  p = Profile.in(":dateOfBirth.Date.today.month" => user.profile.dateOfBirth.Date.today.month, ":dateOfBirth.Date.today.day" => user.profile.dateOfBirth.Date.today.day- 3)
  p p.size
end

ユーザーモデルには次の関係があります。

class User
  embeds_one :profile
end

そして、これは私のプロファイルモデルにあります:

class Profile
  embedded_in :user
end

ここで何が間違っていますか?

4

0 に答える 0