share / share/sharedb

Document Bulk Operations in README

Open
#425 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
6.5k
Forks
456
Avg merge
1d 5h
Merged PRs (30d)
5

Description

Following up from the discussion in https://github.com/share/sharedb/issues/422#issuecomment-755458497 , it would be great to document the bulk operation features of ShareDB in the README.

Here's a start:

const doc1 = connection.get('foo', 'd1');
const doc2 = connection.get('foo', 'd2');

connection.startBulk();
// Issue all the fetches for this bulk request. Could use `async.each` for many docs in an array.
doc1.fetch(() => {});
doc2.fetch(() => {});
// Send all the queued-up doc fetches to the server in a single `bf` request.
// Callbacks for each of the `fetch` calls will be called when the data is received by the client
connection.endBulk();

That sends the fetch to the backend in a single bf (bulk fetch) request, and sharedb-mongo at least will handle fetching the batch of docs with one find() command.

Contributor guide

No contributing guide indexed for this repository

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 with the repository README and the discussion linked from issue #422, then review the provided bulk-operation example and the descriptions of the bf request and callbacks. Done means the README explains how to use connection.startBulk() and connection.endBulk() for multiple fetches, including the relevant behavior of sharedb-mongo.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.