本文整理汇总了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} });
},
示例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 });
}
示例3:
Meteor.startup(function () {
if (Meteor.isServer) {
Logs.remove({});
Players.remove({ karma: { $lt: -2 } });
}
});
示例4: function
'click .remove': function () {
Messages.remove(this._id);
}
示例5: function
'tasks.deleteTask': function(taskId) {
Tasks.remove(taskId);
},
示例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
}
});