简体   繁体   中英

Mongo document is lacking the shard key property

I am aware of what does it mean by "Sharding". However, i do not know how do I include the Shard key in a mongo document. please share an example.

Shard key of a collection can be an existing key or you can create a separate unique key for in your document specifically for the sharding.

In any case, you need to choose a shard key with some specific attributes: Please refer more here:

https://docs.mongodb.com/manual/core/sharding-shard-key/#choosing-a-shard-key

https://docs.mongodb.com/v3.4/reference/limits/#limits-shard-keys

(If you are not quite sure what needs to be the shard key, auto-generated _id of the collection will be a good starting point.)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM