我在mongo db中更新集合。但是找不到比赛。这是我的代码。
- (void)viewDidLoad {
[super viewDidLoad];
[self.button addTarget:self action:@selector(changeButtonToAppearHightlighted:) forControlEvents:UIControlEventTouchDown | UIControlEventTouchDragInside];
[self.button addTarget:self action:@selector(changeButtonToAppearUnhightlighted:) forControlEvents:UIControlEventTouchDragOutside | UIControlEventTouchCancel | UIControlEventTouchUpOutside | UIControlEventTouchUpInside];
}
- (void)changeButtonToAppearHightlighted:(UIButton *)sender {
if ([sender isEqual:self.button]) {
sender.tintColor = BUTTON_TINTCOLOR_HIGHLIGHTED;
sender.backgroundColor = BUTTON_BACKGROUNDCOLOR_HIGHLIGHTED;
}
}
- (void)changeButtonToAppearUnhightlighted:(UIButton *)sender {
if ([sender isEqual:self.button]) {
sender.tintColor = BUTTON_TINTCOLOR_UNHIGHLIGHTED;
sender.backgroundColor = BUTTON_BACKGROUNDCOLOR_UNHIGHLIGHTED;
}
}
答案 0 :(得分:0)
您正在尝试更新不可变的_id字段,您需要创建一个新条目并通过将文档存储到变量中然后使用新的_id保存它然后删除旧文档来删除旧条目。