在update()$ set之后删除字段?

Nat*_*han 1 mongodb meteor

例如,我的用户集合如下所示:

_id: MhReTBKqXR9xTGuK4,
profile: {
    name: 'Nathan',
    wins: '16',
    team: 'The Mashers'
}
Run Code Online (Sandbox Code Playgroud)

所以,假设我想改变我的团队名称:

Meteor.users.update({...},{ $set: { profile: { team: 'The Bashers' } } });
Run Code Online (Sandbox Code Playgroud)

我假设我的团队名称已更新,而我的其他字段未更改.但是,当我打电话找我的用户时,我得到了这个:

_id: MhReTBKqXR9xTGuK4,
profile: {
    team: 'The Bashers'
}
Run Code Online (Sandbox Code Playgroud)

我没有更新的字段现在已经消失了!他们去哪儿了?我不明白为什么这些字段被删除了.我究竟做错了什么?

谢谢,内森

Hub*_* OG 6

尝试:

Meteor.users.update({...},{ $set: { 'profile.team': 'The Bashers' } });
Run Code Online (Sandbox Code Playgroud)