Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.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
使用Meteor.users上的排序查找未使用profile.fieldname的用户_Meteor - Fatal编程技术网

使用Meteor.users上的排序查找未使用profile.fieldname的用户

使用Meteor.users上的排序查找未使用profile.fieldname的用户,meteor,Meteor,我正在尝试对返回的用户集合进行排序。具体来说,我想在profile.lastlogin中对UNIX时间戳进行排序。所以我认为下面的代码可以工作,但不幸的是meteor总是抛出意外标记的错误(profile.lastlogin中的点)。你知道我做错了什么吗?在没有任何fieldname的普通集合上进行普通排序。fieldname notatin正常工作 Template.profiles.helpers({ filteredUsers: function () { return Met

我正在尝试对返回的用户集合进行排序。具体来说,我想在profile.lastlogin中对UNIX时间戳进行排序。所以我认为下面的代码可以工作,但不幸的是meteor总是抛出意外标记的错误(profile.lastlogin中的点)。你知道我做错了什么吗?在没有任何fieldname的普通集合上进行普通排序。fieldname notatin正常工作

Template.profiles.helpers({
  filteredUsers: function () {
    return Meteor.users.find({
      $and: [
        {'_id': { $ne: Meteor.userId()} }, {'profile.interestone': Meteor.user().profile.interestone}
      ]
    }, {sort: {profile.lastlogin: 1}});
  }
});

当使用点表示法访问数组元素或嵌入文档的字段时,需要将语句括在引号中:“some.thing”。在你的情况下,那就是

{sort: {'profile.lastlogin': 1}}