MongoEngine / MongoEngine/mongoengine

Support for shard keys in embedded documents

Open
#551 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Enhancement
Dominant language
Python
Stars
4.3k
Forks
1.2k
Avg merge
4h 41m
Merged PRs (30d)
11

Description

Currently _object_key() only supports shard keys that are Document-level attributes, but MongoDB supports shard keys that are in embedded documents.

There does not seem to be a way using meta's shard_key to define these embedded shard keys in such a way that allows updates and saves to work again.

This seems to be an issue in 0.7, 0.8, dev, and master branches. I am currently having this issue with the 0.8.3 release.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing _object_key() and the metadata shard_key handling described in the issue. Check how embedded shard keys are represented and how updates and saves use the resulting key. Done means embedded-document shard keys work for updates and saves across the affected branches or supported versions.

Written by the indexing model from the issue text.

Assessment

Tech stack
mongodb, python
Domain
backend, databases
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.