當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。