share / share/sharedb-mongo

Change middleware hooks to be wrappers for Mongo driver methods

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

Nobody has claimed this yet.

breaking-change
Dominant language
JavaScript
Stars
152
Forks
68
Avg merge
1d 5h
Merged PRs (30d)
3

Description

We're finding more and more that it can be useful to intercept Mongo driver method calls in a way that also has sharedb / shareedb-mongo context, e.g.:
https://github.com/share/sharedb-mongo/pull/120

The current approach is to have middleware hooks based on sharedb-mongo actions, e.g. Actions.beforeSnapshotLookup.

@alecgibson and I are thinking that it could be more flexible to have a generic hook based on the Mongo driver method name, e.g. find, that provides the sharedb-specific actions or contexts behind the call, and allows customizing all arguments passed to the driver.

That would require us to drop support for Mongo driver 2.x, as find only started taking an options object in Mongo driver 3.x.

Mongo driver 2.x is no longer officially supported anyways. Also, the 2.x driver is only officially compatible up through Node 8, which was end-of-life as of 2019-12-31:
https://docs.mongodb.com/drivers/node/compatibility/

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 by reading the existing sharedb-mongo middleware hooks, especially Actions.beforeSnapshotLookup, and compare the Mongo driver 3.x and 4.x find APIs linked in the issue. Define how hooks keyed by Mongo driver method names expose ShareDB context and customize all driver arguments, then verify that Mongo driver 2.x support is intentionally dropped.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb
Domain
backend, databases
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.