{"id":17193696,"url":"https://github.com/andrei-markeev/mongodb-livedata-server","last_synced_at":"2026-03-06T01:34:22.376Z","repository":{"id":83676787,"uuid":"563040486","full_name":"andrei-markeev/mongodb-livedata-server","owner":"andrei-markeev","description":"Standalone live data server implementation extracted from Meteor, Fibers removed and converted to TypeScript.","archived":false,"fork":false,"pushed_at":"2025-06-01T07:40:26.000Z","size":210,"stargazers_count":4,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-10T23:40:02.980Z","etag":null,"topics":["mongodb","websocket"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/andrei-markeev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2022-11-07T19:33:44.000Z","updated_at":"2025-06-15T13:42:09.000Z","dependencies_parsed_at":"2025-04-13T20:11:48.403Z","dependency_job_id":"9e8b5517-4964-44b6-9f52-ef2c2721b8a6","html_url":"https://github.com/andrei-markeev/mongodb-livedata-server","commit_stats":{"total_commits":14,"total_committers":1,"mean_commits":14.0,"dds":0.0,"last_synced_commit":"58ed9bf28e4726144beddb46b3f06c94a0cdb6b3"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/andrei-markeev/mongodb-livedata-server","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrei-markeev%2Fmongodb-livedata-server","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrei-markeev%2Fmongodb-livedata-server/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrei-markeev%2Fmongodb-livedata-server/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrei-markeev%2Fmongodb-livedata-server/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/andrei-markeev","download_url":"https://codeload.github.com/andrei-markeev/mongodb-livedata-server/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/andrei-markeev%2Fmongodb-livedata-server/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30157846,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-05T22:39:40.138Z","status":"ssl_error","status_checked_at":"2026-03-05T22:39:24.771Z","response_time":93,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["mongodb","websocket"],"created_at":"2024-10-15T01:44:45.514Z","updated_at":"2026-03-06T01:34:22.368Z","avatar_url":"https://github.com/andrei-markeev.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"MongoDB Live Data Server\n========================\n\nThis project is essentially a MongoDB live data driver (based either on polling or on Oplog tailing) combined with a DDP server, extracted\nout of [Meteor](https://github.com/meteor/meteor), with **Fibers** and **underscore** dependencies removed and code converted to Typescript.\n\nLive data is one of the root concepts of Meteor. Data is served via WebSockets via the DDP protocol and updated automatically whenever something changes in the database. Also, calling server methods via WebSocket is supported.\n\nUsing Meteor locks you into the Meteor ecosystem, which has some problems (mostly for historical reasons). Using live data as a separate npm package might be preferable in many scenarios. Also, people who are trying to migrate from Meteor, might find this package useful as an intermediate step.\n\n### Installation\n\n```\nnpm i mongodb-livedata-server\n```\n\n### Usage\n\nAs a most common example, this is how you can use livedata with Express.js:\n\n```js\nconst { DDPServer, LiveCursor, LiveMongoConnection } = require('mongodb-livedata-server')\nconst express = require('express')\nconst app = express()\nconst port = 3000\n\napp.get('/', (req, res) =\u003e {\n  res.send('Hello World!')\n})\n\nconst httpServer = app.listen(port, () =\u003e {\n  console.log(`Example app listening on port ${port}`)\n})\n\nconst liveMongoConnection = new LiveMongoConnection(process.env.MONGO_URL, {\n    oplogUrl: process.env.MONGO_OPLOG_URL\n});\nconst liveDataServer = new DDPServer({}, httpServer);\n\nliveDataServer.methods({\n    \"test-method\": async (msg) =\u003e {\n        console.log(\"Test msg: \", msg);\n        return \"hello! Current timestamp is: \" + Date.now()\n    }\n})\n\nliveDataServer.publish({\n    \"test-subscription\": async () =\u003e {\n        return new LiveCursor(liveMongoConnection, \"test-collection\", { category: \"apples\" });\n    }\n})\n\n```\n\n`liveDataServer.methods` and `liveDataServer.publish` have exactly same interface as [Meteor.methods](https://docs.meteor.com/api/methods.html#Meteor-methods) and [Meteor.publish](https://docs.meteor.com/api/pubsub.html#Meteor-publish) respectively, notice however that when publishing subscriptions, you must use `LiveCursor` rather than a normal MongoDB cursor.\n\n### Important notes\n\n- This project has been used in production for over 2 years, however, while it works with our setup, it might not work for your setup. Use at your own risk.\n- Neither method context nor subscription context have the `unblock` method anymore (because this package doesn't use Fibers)\n- Meteor syntax for MongoDB queries is not supported. Please always use MongoDB Node.js driver syntax. For example, instead of\n  ```ts\n  const doc = myCollection.findOne(id);\n  ```\n  use\n  ```ts\n  const doc = await myCollection.findOne({ _id: id });\n  ```\n- Neither `MongoDB.ObjectId` nor it's Meteor.js alternative is supported at the moment. String ids only.\n\n### DDP Extension\n\n- Starting from 0.1.0, this library extends DDP with `init` message, which is used to avoid initial spam of `added` messages.\n- Starting from 0.1.1, `init` message will only be sent if `version` `1a` of DDP protocol is specified. Additionally, when version `1a`\nis specified, server will not send removes for all documents when stopping a subscription, and rely on the client for the cleanup instead.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrei-markeev%2Fmongodb-livedata-server","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fandrei-markeev%2Fmongodb-livedata-server","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fandrei-markeev%2Fmongodb-livedata-server/lists"}