share / share/sharedb-mongo

Unable to create subscribe query

Open
#52 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

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

Description

Until now I used the default database adapter for ShareDB, but since I want to support persistent storage, I decided to use this adapter. Only there seems to be a problem when calling connection.createSubscribeQuery(...):

TypeError: Cannot read property '$query' of undefined
    at DB.ShareDbMongo.checkQuery (node_modules\sharedb-mongo\index.js:853:12)
    at DB.ShareDbMongo._getSafeParsedQuery (node_modules\sharedb-mongo\index.js:939:18)
    at DB.ShareDbMongo._query (node_modules\sharedb-mongo\index.js:625:21)
    at node_modules\sharedb-mongo\index.js:686:10
    at node_modules\sharedb-mongo\index.js:74:12
    at DB.ShareDbMongo.getDbs (node_modules\sharedb-mongo\index.js:109:26)
    at DB.ShareDbMongo.getCollection (node_modules\sharedb-mongo\index.js:71:8)
    at DB.ShareDbMongo.query (node_modules\sharedb-mongo\index.js:683:8)
    at Backend._query (node_modules\sharedb\lib\backend.js:495:14)
    at node_modules\sharedb\lib\backend.js:452:15

This is the code which creates the ShareDB backend:

var ShareDB = require('sharedb');
var ShareDBMongo = require('sharedb-mongo');
var sharedb = new ShareDB({db: ShareDBMongo('mongodb://localhost:27017')});
var connection = sharedb.connect();

Everything used to run correctly before (without providing the option, i.e. just using new ShareDB()).

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

Reproduce the failure using the shown ShareDB and sharedb-mongo setup, starting at connection.createSubscribeQuery and the sharedb-mongo checkQuery stack trace. Trace why the query argument is undefined, then verify that createSubscribeQuery works with the MongoDB adapter without the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, mongodb
Domain
backend, database
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.