当前位置: 首页>>代码示例>>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;未经允许,请勿转载。