这是我收到的确切错误
MongoError:无法规范化查询:BadValue不支持的投影选项:$ set:{players:[“1382306895402433”]}
我的mongoose查询类似于:
FollowModel.findOne(
{userId: req.user.userId},
{$set: {players: req.body.players}},
{upsert: true, 'new': true},
function() {
res.status(200).send();
}
);
req.body.players = [1382306895402433];
在我的架构中,玩家被定义为数组。
为什么mongoose会抛出一个错误?
答案 0 :(得分:0)
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSDictionary * listEntry;
listEntry = [self.listEntries objectAtIndex:((NSUInteger) indexPath.row) - 1];
NSString *dict=[listEntry objectForKey:(id) kCFFTPResourceName];
NSLog(@"dict%@",dict);
NSString *fvalue = [NSString stringWithFormat:@"/%@/",dict];
NSLog(@"%@",fvalue);
NSString *appendURl=[NSString stringWithFormat:@"%@%@",self.urlText.text,fvalue];
self.urlText.text=appendURl;
}
以及$set
是更新运算符,不能用于查找查询。我认为你的意思是使用更新。
upsert