我想删除一些我的子集合,其中主题作为特殊值但我不知道如何。
deleteThisTopic() {
Topics.remove(this.props.topic._id);
Subs.remove({"topic":"this.props.topic"});
}
test() {
window.topicText=this.props.topic.text;
}
render() {
return (
<Router>
<div>
<ul>
<Link to="/sub"><li onClick={this.test.bind(this)}>{this.props.topic.text} ARN: {this.props.topic.arn}</li></Link>
<Link to="/log"><button onClick={this.test.bind(this)}>S'inscrire</button></Link>
<Link to="/"><button >Cacher</button></Link>
<button onClick={this.deleteThisTopic.bind(this)}>Suprimer</button>
</ul>
&#13;
答案 0 :(得分:1)
您应该只传递topic
值:
deleteThisTopic() {
const topic = this.props.topic._id;
Topics.remove(topic);
Subs.remove({ topic }); // equals to { topic: topic }
}