当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Meteor.users.find方法代码示例

本文整理汇总了TypeScript中meteor/meteor.Meteor.users.find方法的典型用法代码示例。如果您正苦于以下问题:TypeScript Meteor.users.find方法的具体用法?TypeScript Meteor.users.find怎么用?TypeScript Meteor.users.find使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在meteor/meteor.Meteor.users的用法示例。


在下文中一共展示了Meteor.users.find方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: function

  Meteor.publish(GAME_SUBSCRIPTION_NAME, function (options:GameSubscriptionOptions) {
    if (!this.userId) {
      log.warn('Subscription denied due to no userId');
      return this.ready(); // Must be logged in
    }
    let gameUserIds:string[] = [];
    let handsCursor = HandCollection.find({gameId: options.gameId});
    handsCursor.forEach((game:Hand)=> {
      gameUserIds.push(game.userId);
    });
    if (gameUserIds.indexOf(this.userId)===-1) {
      let user:Meteor.User = Meteor.users.find({_id: this.userId});
      if (!AccountsAdminTools.isAdmin(user))
        return this.ready(); // Game only visible to its players or admins
    }
    let userCursor =  Meteor.users.find(
      {_id: {$in: gameUserIds}},
      {
        fields: {
          username: true,
          profile: true,
          emails: true
        }
      }
    );
    let actionCursor = GamePlayActionCollection.find({gameId: options.gameId});
//    log.debug("publish gameinfo: " + ", GameId:" + options.gameId +  ", userCount: " + userCursor.count(), ", hands count: " + handsCursor.count(), " action count:" + actionCursor.count())
    return [
      userCursor,
      handsCursor,
      actionCursor
    ];
  });
开发者ID:kokokenada,项目名称:for-real-cards,代码行数:33,代码来源:game.publications.ts

示例2: function

Meteor.publish('users.list', function(options: Object, email: string) {
  // if(options != undefined){
  console.log("?", options);
  let _op = options;

    Counts.publish(this, 'numberOfUsers',
       Meteor.users.find({}), { noReady: true });
    return Meteor.users.find({}, _op);
  // }
});
开发者ID:p3140,项目名称:angular2-meteor-starter-kit,代码行数:10,代码来源:users.ts

示例3: function

Meteor.publish("users", function (options: Object, searchString: string) {



    var search = new RegExp('.*' + searchString, 'i');
    console.log(search)

    Counts.publish(this, 'numberOfRecords', Meteor.users.find({ 'emails.address': search }), { noReady: true });
    // return Meteor.users.find({selector}, { fields: { 'emails.address': 1, profile: 1, roles: 1, createdAt: 1, width: 1, height: 1, imageAsData: 1 } });
    return Meteor.users.find({ 'emails.address': search }, options);
});
开发者ID:admirkb,项目名称:ads,代码行数:11,代码来源:users.ts

示例4:

Meteor.startup(function () {

  if (Meteor.users.find().fetch().length === 0) 
  {
    var users = [
        {name:"Test1",email:"test1@example.com",roles:[]},
        {name:"Test2",email:"test2@example.com",roles:[]},
        {name:"Test3",email:"test3@example.com",roles:[]},
        {name:"Admin",email:"admin@example.com",roles:['admin']}
      ];

	for (var i = 0; i < users.length; i++) 
	{      
      console.log(users[i]);
      var id = Accounts.createUser({
        email: users[i].email,
        password: "password",
        profile: { name: users[i].name }
      });
      // email verification
      Meteor.users.update({_id: id}, {$set:{'emails.0.verified': true}});
      Roles.addUsersToRoles(id, users[i].roles); 
    }
  }

});
开发者ID:Feldor,项目名称:society,代码行数:26,代码来源:main.ts

示例5: function

 Meteor.publish('users', function() {
   return Meteor.users.find({}, {
     fields: {
       emails: 1,
       profile: 1
     }
   });
 });
开发者ID:AyushAnandChouksey,项目名称:meteor-angular-socially,代码行数:8,代码来源:users.ts

示例6:

Meteor.publish('users', () => {
  return Meteor.users.find({}, {
    fields: {
      username: 1,
      profile: 1
    }
  });
});
开发者ID:RizkiMufrizal,项目名称:Socially-Angular2-Meteor,代码行数:8,代码来源:users.ts

示例7: onSearchKeyup

 onSearchKeyup(value){
     if(value.length > 3){
         this.users = Meteor.users.find({
             'profile.name': {$regex : '.*' + value + '.*'}
         }).fetch();
     }else{
         this.users = [];
     }
 }
开发者ID:albertvazquezm,项目名称:present,代码行数:9,代码来源:user-search-form.ts

示例8: getAdvancedUser

export function getAdvancedUser(userId: string) {
    return Meteor.users.find({
        _id: userId
    }, {
        fields: {
            opponents: 1,
            liked: 1
        }
    });
}
开发者ID:Puzochacha,项目名称:rhy,代码行数:10,代码来源:user.ts

示例9: getUsers

 getUsers(party: Party) {
   if(party) {
     this.users = Meteor.users.find({
       _id: {
         $nin: party.invited || [],
         $ne: Meteor.userId()
       }
     });
   }
 }
开发者ID:verdantred,项目名称:torni,代码行数:10,代码来源:party-details.ts

示例10: function

Meteor.publish('uninvited', function(partyId: string) {
    let party = Parties.findOne(partyId);

    if (!party)
        throw new Meteor.Error('404', 'No such party!');

    return Meteor.users.find({
        _id: {
            $nin: party.invited || [],
            $ne: this.userId
        }
    });
});
开发者ID:RichardHwang886,项目名称:socially16,代码行数:13,代码来源:users.ts


注:本文中的meteor/meteor.Meteor.users.find方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。