Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/365.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/svg/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Meteor Mongo获得特定值_Javascript_Mongodb_Meteor - Fatal编程技术网

Javascript Meteor Mongo获得特定值

Javascript Meteor Mongo获得特定值,javascript,mongodb,meteor,Javascript,Mongodb,Meteor,我拥有具有以下值的集合: Plans.insert({ location, address, date, time, notes, createdAt: new Date(), // current time owner: Meteor.userId(), username: Meteor.user().username, attendees: [ { user: Meteor.user().username; },

我拥有具有以下值的集合:

Plans.insert({
  location,
  address,
  date,
  time,
  notes,
  createdAt: new Date(), // current time
  owner: Meteor.userId(),
  username: Meteor.user().username,
  attendees: [
     {
        user: Meteor.user().username;
     },         
     {
        user: Meteor.user().username;
     },
  ],
});

但我想知道如何才能获得数组
与会者的具体值

到目前为止,我已经尝试了
Plans.findOne({u id:{attenders:[{user:Meteor.user().username},],})但结果是未定义的


我还想知道如何获得每个人的数值,例如
与会者[0]
与会者[1]

您需要使用
$elemMatch

Plans.findOne({attendees: {$elemMatch: {user: 'ABC'}}};

“如何获得阵列与会者的特定值”-意味着什么?获取在Attendeers数组中具有特定值的文档?是否有方法获取所有具有该值的集合
$elemMatch
只检索第一个匹配项,但我需要所有适用的内容。你是说关于文档,没有收集仪式?是的,对不起,我指的是文档。