Home > Enterprise >  Shard on subset of id's fields
Shard on subset of id's fields

Time:01-01

I have a document of which the identifier (_id) is a document itself. For example:

{
    "_id": {
        "userIdentifier": 50,
        "eventIdentifier": 47
    },
    "location": "New York",
    "outcome": "SUCCESS"
}

Is it possible with this kind of document and id definition to apply hash sharding on _id.userIdentifier?

CodePudding user response:

Yes, you can shard on that field as long as you have created an index on the field, and it exists in every document.

  • Related