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


TypeScript mongo.Mongo.Collection类代码示例

本文整理汇总了TypeScript中meteor/mongo.Mongo.Collection的典型用法代码示例。如果您正苦于以下问题:TypeScript Mongo.Collection类的具体用法?TypeScript Mongo.Collection怎么用?TypeScript Mongo.Collection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: function

 Meteor.publish('common-app.avatar-images', function (_id, counter) {
   if (!_.isArray(_id))
     _id = [_id];
   return [
     AvatarOriginalCollection.find({_id: {$in: _id}, userId: this.userId}),
     AvatarMediumCollection.find({_id: {$in: _id}, userId: this.userId}),
     AvatarThumbCollection.find({_id: {$in: _id}, userId: this.userId})
   ];
 });
开发者ID:kokokenada,项目名称:for-real-cards,代码行数:9,代码来源:avatar.model.ts

示例2: addAction

function addAction(action:GamePlayAction, userId:string):string {
  if (action.creatorId !== userId)
    throw new Meteor.Error('invalid-user', 'current userId does not match user ID of passed object');
  checkUser(action.gameId, action.creatorId);
  action.cardsEncoded = CardEncoder.encodeCards(action.cards);
  if (action.gameConfig) {
    action.gameConfig._deck_id = action.gameConfig.deck.id;
  } else {
  }
  return GamePlayActionCollection.insert(action);
}
开发者ID:kokokenada,项目名称:for-real-cards,代码行数:11,代码来源:action.model.ts

示例3: function

	archiveTask: function (taskId: string, compt?: number) {
		check(taskId, String);
		let c = compt || 0;
		let user = Meteor.user();
		let task = Tasks.findOne(taskId);
		let auth = false;
		if (!user || !task) {
			throw new Meteor.Error('not-authorized');
		}
		let project = Projects.findOne(task.project);
		if (!project) {
			throw new Meteor.Error('404', 'project-not-found');
		}
		if (task.owner === user._id) {
			auth = true;
		}
		if (user._id === project.owner) {
			auth = true;
		}
		if (!auth) {
			throw new Meteor.Error('not-authorized');
		}
		Tasks.update(taskId, {
			$set: {
				archived: true,
				archivor: user._id
			}
		});
		if (task.hasSubTasks) {
			// on update et complete les sub tasks (qui ne le sont pas uniquement).
			Tasks.update(
				{
					parentTask: task._id,
					archived: false,
				},
				{
					$set: {
						archivor: user._id,
						archived: true
					}
				},
				{
					multi: true
				}
			);
			if (c >= 100) {
				throw new Meteor.Error('500', 'too-many-rec');
			} 
			task.subTasks.forEach((subTaskId) => {
				Meteor.call('archiveTask', subTaskId, c+1);
			});
		}
	},
开发者ID:djulls07,项目名称:projects-manager,代码行数:53,代码来源:tasks.ts

示例4: function

 'tasks.addTask': function(text) {
   Tasks.insert({
     text: text,
     checked: false,
     private: false
   });
 },
开发者ID:RichardHwang886,项目名称:todo4,代码行数:7,代码来源:tasks.ts

示例5: function

Meteor.publish("counts-by-room", function (roomId: string) {
    var self = this;
    check(roomId, String);
    var count = 0;
    var initializing = true;
    var handle = Messages.find({ roomId: roomId }).observeChanges({
        added: function (id: any) {
            count++;
            // if (!initializing)
            //   this.changed("counts", roomId, {count: count});
        },
        removed: function (id: any) {
            count--;
            // Todo: Not sure how to define in typescript
            //      self.changed("counts", roomId, {count: count});
        }
    });

    initializing = false;

    // Todo: Not sure how to define in typescript
    //  self.added("counts", roomId, {count: count});
    self.ready();

    self.onStop(function () {
        handle.stop();
    });
});
开发者ID:Jeremy-F,项目名称:DefinitelyTyped,代码行数:28,代码来源:meteor-tests.ts

示例6: function

	destroyComponentUpload: function() {
		// On retire tous les fichiers non link a au moins 1 projet et appartenant au user co.
		// finalement on ne regarde meme pas filesIds
		/*let f = MyFiles.find({ userId: Meteor.userId(), projectId: { $exists: false } });
		console.log('Files will be removed (destroyed component):', f.count());*/
		MyFiles.remove({ userId: Meteor.userId(), projectId: {$exists: false} });
	},
开发者ID:djulls07,项目名称:projects-manager,代码行数:7,代码来源:my-files.ts

示例7: recordEvent

export function recordEvent(charId: number, text: string) {
  EventLog.insert({
    text: text,
    time: new Date(),
    charid: charId,
  });
}
开发者ID:paralin,项目名称:evewaitlist,代码行数:7,代码来源:events.ts

示例8: function

 'tasks.addTask': function(text: string) {
   Tasks.insert({
     text: text,
     checked: false,
     private: false,
     createdAt: new Date()
   });
 },
开发者ID:DAB0mB,项目名称:angular2-meteor,代码行数:8,代码来源:tasks.ts


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