(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 }

댓글

이 블로그의 인기 게시물

(ElasticSearch) 결과에서 순서 정렬

(네트워크)폴링방식 vs 롱 폴링방식

(18장) WebSocekt과 STOMP를 사용하여 메시징하기