rxdb | A fast , offline-first , reactive Database for JavaScript | Database library

 by   pubkey TypeScript Version: 15.24.0 License: Apache-2.0

kandi X-RAY | rxdb Summary

kandi X-RAY | rxdb Summary

rxdb is a TypeScript library typically used in Database, Angular, React, Nodejs, MongoDB applications. rxdb has no bugs, it has no vulnerabilities, it has a Permissive License and it has medium support. You can download it from GitHub.

RxDB (short for Reactive Database) is a NoSQL-database for JavaScript Applications like Websites, hybrid Apps, Electron-Apps, Progressive Web Apps and Node.js. Reactive means that you can not only query the current state, but subscribe to all state changes like the result of a query or even a single field of a document. This is great for UI-based realtime applications in way that makes it easy to develop and also has great performance benefits. To replicate data between your clients and server, RxDB provides modules for realtime replication with any CouchDB compliant endpoint and also with custom GraphQL endpoints.

            kandi-support Support

              rxdb has a medium active ecosystem.
              It has 19309 star(s) with 977 fork(s). There are 222 watchers for this library.
              There were 10 major release(s) in the last 6 months.
              There are 3 open issues and 598 have been closed. On average issues are closed in 7 days. There are 14 open pull requests and 0 closed requests.
              It has a neutral sentiment in the developer community.
              The latest version of rxdb is 15.24.0

            kandi-Quality Quality

              rxdb has 0 bugs and 0 code smells.

            kandi-Security Security

              rxdb has no vulnerabilities reported, and its dependent libraries have no vulnerabilities reported.
              rxdb code analysis shows 0 unresolved vulnerabilities.
              There are 0 security hotspots that need review.

            kandi-License License

              rxdb is licensed under the Apache-2.0 License. This license is Permissive.
              Permissive licenses have the least restrictions, and you can use them in most projects.

            kandi-Reuse Reuse

              rxdb releases are available to install and integrate.
              Installation instructions, examples and code snippets are available.
              It has 33691 lines of code, 0 functions and 363 files.
              It has low code complexity. Code complexity directly impacts maintainability of the code.

            Top functions reviewed by kandi - BETA

            kandi's functional review helps you automatically verify the functionalities of the libraries and avoid rework.
            Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of rxdb
            Get all kandi verified functions for this library.

            rxdb Key Features

            No Key Features are available at this moment for rxdb.

            rxdb Examples and Code Snippets

            RxDB Search plugin,API
            TypeScriptdot img1Lines of Code : 26dot img1no licencesLicense : No License
            copy iconCopy
            import { addRxPlugin } from 'rxdb'
            import rxdbSearch from 'rxdb-search'
            const { RESULT, RESULT_LENGTH } = await collection.search(query: string, siQUERYoptions ?: {})
            `collection.search` is just  

            Community Discussions


            WebSQL threw an error [Error: Error code 1: no such table: document-store]
            Asked 2021-Aug-06 at 15:52

            We are using react-naive-sqlite-2 in our application with RxDB and started getting this error somewhat sporadically. It seems to happen after we remove the database. I was surprised to see this was a WebSQL error since we are using react-native and WebSQL is deprecated. I don't have great ways to debug this but my hunch is that we have some code that still tries to access the now dead database.

            This is the code we use to set up our database:



            Answered 2021-Aug-06 at 15:52

            For posterity, the issue was that we had a reference to the database in our state management library (Zustand) that was being held onto past logout. When we tried to login again, our getOrCreateDatabase function didn't make a new one but it wasn't valid since we had run database.remove() in rxdb. We ended up just clearing the Zustand db and calling database.remove() at one place.

            Source https://stackoverflow.com/questions/68656118


            rxdb: migration of document failed final document does not match final schema
            Asked 2020-Aug-26 at 23:45

            I just changed my rxdb schema version from 0 to 1 in order to add a deletedAt attribute. I added a migration strategy for going from ver 0 to 1.

            Now I'm getting this error: "migration of document failed final document does not match final schema". The final doc is in screenshot below:

            I thought maybe I had to add the _rev field; adding _rev to schema didn't remove the error, so I've taken it back out. Ditto with a deleted field (complains I can't add it as a top-level attribute). So I am at a loss as to why else the final object differs from the expected schema?

            type info ...


            Answered 2020-Aug-26 at 23:45

            The problem was that deletedAt, which I had just added, was defined like this in the json schema:

            Source https://stackoverflow.com/questions/63605140


            Data syncing with pouchdb-based systems client-side: is there a workaround to the 'deleted' flag?
            Asked 2020-Aug-26 at 13:02

            I'm planning on using rxdb + hasura/postgresql in the backend. I'm reading this rxdb page for example, which off the bat requires sync-able entities to have a deleted flag.

            Q1 (main question)
            • Is there ANY point at which I can finally hard-delete these entities? What conditions would have to be met - eg could I simply use "older than X months" and then force my app to only ever displays data for less than X months?
            • Is such a hard-delete, if possible, best carried out directly in the central db, since it will be the source of truth? Would there be any repercussions client-side that I'm not foreseeing/understanding?

            I foresee the number of deleted's growing rapidly in my app and i don't want to have to store all this extra data forever.

            Q2 (bonus / just curious)

            • What is the (algorithmic) basis for needing a 'deleted' flag? Is it that it's just faster to check a flag rather than to check for the omission of an object from, say, a very large list. I apologize if it's kind of a stupid question :(


            Answered 2020-Aug-26 at 13:02

            Ultimately it comes down to a decision that's informed by your particular business/product with regards to how long you want to keep deleted entities in your system. For some applications it's important to always keep a history of deleted things or even individual revisions to records stored as a kind of ledger or history. You'll have to make a judgement call as to how long you want to keep your deleted entities.

            I'd recommend that you also add a deleted_at column if you haven't already and then you could easily leverage something like Hasura's new Scheduled Triggers functionality to run a recurring job that fully deletes records older than whatever your threshold is.

            You could also leverage Hasura's permissions system to ensure that rows that have been deleted aren't returned to the client. There is documentation and examples for ways to work with soft deletes and Hasura

            For your second question it is definitely much faster to check for the deleted flag on records than to have to try and diff the entire dataset looking for things that are now missing.

            Source https://stackoverflow.com/questions/63588982


            Electron App - Divide main process into several files and share variable
            Asked 2020-Aug-18 at 12:47

            I'm developing an app with Electron, but I have a problem to exchange a variable between several files.

            In my main.js, I create an RxDB database that is used for my entire project. At this level, I also create handlers allowing the communication between the main process and the render process via IPC. These handlers call various Classes that perform various processes including database insertions, modifications, etc.

            In my opinion, I haven't found an efficient way to transmit my variable containing my database to my classes.

            Ideally, I should be able to call this database variable (declared in main.js) at any time from any class. I can't use the IPC system because my returned variable must not be a JSON but absolutely an RxDatabase object.

            Here is a very simplified diagram of my main process:

            Currently, to share my database variable to my classes:

            • I declare the variable in main.js
            • I transmit the variable in the handlers
            • I transmit the variable to my classes in a static variable class

            Although ugly, this system works. But I think there is a more correct way to do it. Also, it becomes difficult to preserve this variable when a class calls one or more instances of external classes.




            Answered 2020-Aug-18 at 11:42

            A simple export / import is enough.

            Previously, I tried to export my variable from main.js but when I tried to use export {database}, I had an Unexpeted token export error.So I had assumed that it would be impossible for me to export a variable from main.js for some obscure reasons specific to Electron.

            In fact, you just need to use a ES5 syntax, that way exports.database = database in main.js. Then, you can import this variable in any file of your main process.

            Thanks @Luke for his answer.

            Source https://stackoverflow.com/questions/63465921

            Community Discussions, Code Snippets contain sources that include Stack Exchange Network


            No vulnerabilities reported

            Install rxdb

            Get started now by reading the docs or exploring the example-projects.


            RxDB is made so that you can use exactly the same code at. We optimized, double-checked and made boilerplates so you can directly start to use RxDB with frameworks like.
            Find more information at:

            Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items

            Find more libraries
          • npm

            npm i rxdb

          • CLONE
          • HTTPS


          • CLI

            gh repo clone pubkey/rxdb

          • sshUrl


          • Stay Updated

            Subscribe to our newsletter for trending solutions and developer bootcamps

            Agree to Sign up and Terms & Conditions

            Share this Page

            share link