rethinkdb / rethinkdb/docs

Missing example for updating a document inside an array

Open
#1,189 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
CSS
Stars
118
Forks
161
PR merge metrics
No merged PRs in 30d

Description

As reported in https://github.com/rethinkdb/rethinkdb/issues/6182

The example might look like this.

.update(lambda row: {
  "array": row('array').map(lambda elem:
    r.branch(
      elem['name'] == 'Bob',
      elem.merge({ "age": 27 }),
      elem))})

Is there a better way to do this? Perhaps using change_at?

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

Review the proposed update example and the referenced RethinkDB issue #6182 first, then determine whether the example or change_at is the appropriate approach. Done means adding a decided, working example for updating a document inside an array to the documentation.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
databases, documentation
Issue type
Documentation
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.