Search code examples
mongodbmongodb-shell

can i have shard collection without index


i want shard a collection and this collection must have no any index (for fast insert operation). i create collection with autoIndexId : false and shard it, but when shard it, the mongo create index on shard key. Now, Can I have a shard collection without any index ?


Solution

  • No, a shard collections allways needs an index that cannot be changed afterwards. This Index is needed to the distribution across multiple clusters.

    http://docs.mongodb.org/manual/core/sharding-shard-key/