當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript Mongo.Collection.remove方法代碼示例

本文整理匯總了TypeScript中meteor/mongo.Mongo.Collection.remove方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Mongo.Collection.remove方法的具體用法?TypeScript Mongo.Collection.remove怎麽用?TypeScript Mongo.Collection.remove使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在meteor/mongo.Mongo.Collection的用法示例。


在下文中一共展示了Mongo.Collection.remove方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: 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

示例2: function

	removeTask: function (taskId: string) {
		let user = Meteor.user();
		if (!user) {
			throw new Meteor.Error('403', 'not-authorized');
		}
		let task = Tasks.findOne(taskId);
		if (!task) {
			throw new Meteor.Error('404', 'not-found');
		}
		if (task.owner !== user._id) {
			throw new Meteor.Error('403', 'not-authorized');
		}
		if (task.hasSubTasks || task.isSubTask) {
			throw new Meteor.Error('400', 'task-with-sub-tasks-or-parent');
		}
		MyFiles.remove({ modelName: 'task', modelId: taskId });
		// on spĂŠcifie aussi le owner dans le remove
		Tasks.remove({ _id: taskId, owner: user._id });
	}
開發者ID:djulls07,項目名稱:projects-manager,代碼行數:19,代碼來源:tasks.ts

示例3:

Meteor.startup(function () {
    if (Meteor.isServer) {
        Logs.remove({});
        Players.remove({ karma: { $lt: -2 } });
    }
});
開發者ID:Jeremy-F,項目名稱:DefinitelyTyped,代碼行數:6,代碼來源:meteor-tests.ts

示例4: function

 'click .remove': function () {
     Messages.remove(this._id);
 }
開發者ID:Jeremy-F,項目名稱:DefinitelyTyped,代碼行數:3,代碼來源:meteor-tests.ts

示例5: function

 'tasks.deleteTask': function(taskId) {
   Tasks.remove(taskId);
 },
開發者ID:RichardHwang886,項目名稱:todo4,代碼行數:3,代碼來源:tasks.ts

示例6: Date

      status:task.status,
      owner: Meteor.userId(),
      created:new Date()
    });
  },
  'tasks.remove' (taskId) {
    console.log('removing tasks from collection');
    check(taskId, String);
	const task = Tasks.findOne(taskId);
    //if (task.private && task.owner !== Meteor.userId()) {
		//changed when got error in test...
	if (task.owner !== Meteor.userId()) {
      // If the task is private, make sure only the owner can delete it
      throw new Meteor.Error('not-authorized');
    }
    Tasks.remove(taskId);
  },
  'tasks.setStatus' (taskId, status) {
    check(taskId, String);
    check(status, String);
	const task = Tasks.findOne(taskId);
    //if (task.private && task.owner !== Meteor.userId()) {
	if (task.owner !== Meteor.userId()) {
      // If the task is private, make sure only the owner can check it off
      throw new Meteor.Error('not-authorized');
    }
    Tasks.update(taskId, {
      $set: {
        status: status
      }
    });
開發者ID:LIOSK-ORG,項目名稱:todo-app,代碼行數:31,代碼來源:tasks.ts


注:本文中的meteor/mongo.Mongo.Collection.remove方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。