(MongoDB) A single update on a sharded collection must contain an exact match on _id error

In sharding Mongodb cluster
If you do CUD working, it is possible to show you next possible


A single update on a sharded collection must contain an exact match on _id (and have the collection default collation) or contain the shard key (and have the simple collation). Update request

This happend when I did updateFirst query in MongoDB.
Beacuse shard cluster does not find where this document,
the mongos can not find where it is.
actuall UpdateFirst means that to update one document.


If Mongos brodcast all shard cluster to update, it is to violate {multi: false} pharse.

Therefor,
to solve this error,
we need to do one of three

1. to add shard key in query
2. to specify "_id" field which is unique key
3. to configure { multi : true }

댓글

이 블로그의 인기 게시물

(Garbage Collection) Old Area의 Concurrent Mark-sweep 알고리즘

(데이터베이스) HAVING절과 WHERE 절의 차이

(Pytorch) DataLoder 클래스