Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

写入mongos开启upsert报错: An upsert on a sharded collection must contain the shard key #196

Closed
vinllen opened this issue Jul 19, 2019 · 2 comments

Comments

@vinllen
Copy link
Collaborator

vinllen commented Jul 19, 2019

image

@vinllen
Copy link
Collaborator Author

vinllen commented Jul 19, 2019

这个错误发生在用户启用了upsert参数,如果是集群版启用这个参数,update发现数据不存在,将会变成insert操作,但是Insert的数据不包括shard_key。
所以建议不在集群版上开启upsert参数

@vinllen vinllen changed the title 写入mongos开启upsert报错 写入mongos开启upsert报错: An upsert on a sharded collection must contain the shard key Jul 19, 2019
@vinllen vinllen closed this as completed Jul 19, 2019
@vinllen
Copy link
Collaborator Author

vinllen commented Mar 17, 2020

如果集合没有开启分片是没有问题的,只有开启shardCollection才会有问题

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant