从电子邮件地址查找用户

Find user from email address

本文关键字:用户 查找 电子邮件地址      更新时间:2023-09-26

我想使用find返回基于电子邮件地址的用户。

Meteor.users.find({emails : [address : 'aa@gmail.com']} ).fetch() 

它没有工作,我怎么能检索用户这种方式?

您可以使用这个查询:

function findByEmail(email){
  var user = Meteor.users.find({
    "emails.address": email
  }).fetch();
  return user;
}

您可以通过电子邮件查询用户:

Users.find({ email: "useremail@example.com" }).fetch();