Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
    Bhavin Patel
    @itsmebhavin
    Do we know how much for Rx-Sqlite premium package?
    Daniel Meyer
    @pubkey
    @icybergenome there are no fixed prices. It depends on too many factors.
    Also notice that premium plugins are in beta phase atm. So nothing is sold for the next few weeks until all beta users had the chance to report bugs.
    Anton Melser
    @AntonOfTheWoods

    I think maybe I have fundamentally misunderstood how indexes work... My understanding was that I could have something like

    export const heroSchemaLiteral = {
      title: "hero schema",
      description: "describes a simple hero",
      version: 0,
      primaryKey: "name",
      type: "object",
      properties: {
        name: {
          type: "string",
          maxLength: 100,
        },
        hp: { type: "number" },
        maxHP: { type: "number" },
        color: {
          type: "string",
          maxLength: 100,
        },
      },
      required: ["name", "color"],
      indexes: ["color"],
    } as const;
        const toto = await db?.heroes
          .find({
            selector: { color: { $eq: "red" } },
            index: "color",
          })
          .exec();

    But this just always gives "{error: 'unknown_error', message: 'Could not find that index or could not use that index for the query'}".

    I tried various other options, like index: ["color"] and index: ["color", "name"] but it always gives the same error. I am getting this will 12.2 and 12.3.
    At least with 12.3, this appears to only error out with pouchdb and not dexie, though I don't know whether dexie is actually using the index or not.

    25 replies
    Christian M. Austria
    @chan-dev
    I would like to ask if is there a way to group emitted values as one in collection.$.subscribe when using collection.bulkUpsert? Currently, it emits multiple times based on the number of document updated on bulkUpsert.
    Anton Melser
    @AntonOfTheWoods
    I have found a bug/feature that it would be good to get some opinions on how to fix. Basically, the multipleOf on the number type fields has an issue in typescript. The typescript type is number but the validate plugin uses is-my-json-valid, and the method used to validate this in their code is isMultipleOf. The issue with that is that when you pass in a number to that method, it does the following multipleOf.toString().split('.').pop().length to get the length of the remainder to validate a number coming in. Unfortunately, number.toString() in JS when the number is smaller than 0.00001 moves to using exponents, meaning 0.0000001.toString() == "1e-7", which is obviously going to make everything fail erroneously. So!
    • Is this a bug that is-my-json-valid should fix?
    • Is this an issue with the typescript type and we should allow number | string and put a note in the docs to say you MUST use a string if the multipleOf is less than 0.00001?
    • Something else?
    3 replies
    MyoMin Oo
    @zeroone.ucsm_gitlab
    i have an error with TypeError: Cannot read properties of undefined (reading 'key')
    at getPrimaryFieldOfPrimaryKey
    pls help me
    Bilal Saeed
    @icybergenome
    In graphQL, is it possible if we manually invoke push replication only ? I am aware of run() but it runs both push and pull replications. From the type definitions it seems not a chance.
    Actually we are facing a delay in pushing the local document to server. Currently it takes few seconds (around 1.5 seconds on average) to push the document. We want to achieve that fastest way possible.
    Christian M. Austria
    @chan-dev
    Why does piping the rxdb collection observables using bufferTime in rxjs return an empty array each time? The snippet below always returns empty array.
      this.db.userFolderTree.$.pipe(
          bufferTime(1000)
        ).subscribe((changeEvent) => {
          console.log("userFolderTree changeEvent", changeEvent);
          console.dir(changeEvent);
        });
    Mohamed Ezzaouia
    @ezzaouia

    Hello All, please, I'm a new to Rxdb.. Using it with Typescript / React.. I'm trying to save an attachment as

    const attachment = await hero.putAttachment(
          {
            id: "cat.jpg", // (string) name of the attachment like 'cat.jpg'
            data: 'some blob data', // (string|Blob|Buffer) data of the attachment
            type: "text/plain", // (string) type of the attachment-data like 'image/jpeg'
          },
          false // (boolean, optional, default=true) skipIfSame:If true and attachment already exists with same data, the write will be skipped
        );

    I'm getting an error : Uncaught (in promise) TypeError: hero.putAttachment is not a function

    6 replies
    Anton Melser
    @AntonOfTheWoods

    Hi all. So I have just been testing 12.4.1 regarding the query planner and (at least) dexie storage. Consider a collection definitions with a string field graph (amongst others) that has an index (in addition to a pk id). (and in the examples const graph = '那么';)

    Here is what I have found:

    1. In 12.4.1 db.definitions.findOne({ selector: { graph: { $eq: graph } }, }) will use the ["graph", "id"] index with startKey: ['那么', -Infinity] and endKeys: ['那么', '￿'], and also did so with 12.3.2 (and tbh maybe earlier also), with or without a manually specified index: "graph" on the query. Queries get returned in the 2-5ms range.

    2. In 12.3.2 db.definitions.findOne().where("graph").eq(graph) will use the (pointless here) ["id"] index with startKeys: [-Infinity] and endKeys: ['￿']. Performance is horribly slow, queries get returned in the 20-40 SECOND range.

    3. In 12.4.1 db.definitions.findOne().where("graph").eq(graph) will use the ["graph", "id"] index with startKey: [-Infinity, -Infinity] and endKeys: ['￿', '￿']. Performance is very notably better than 12.3.2 but still horrible, in the 5-15 SECOND range.

    Anton Melser
    @AntonOfTheWoods
    "4". 12.4.1 db.definitions.findOne({ selector: { graph } }) will use the ["graph", "id"] index with startKey: [-Infinity, -Infinity] and endKeys: ['￿', '￿'], and so the same performance characteristics as 3.
    Daniel Meyer
    @pubkey
    @AntonOfTheWoods this looks wrong. Having { selector: { graph } } should use a better start/end key
    1 reply
    I will check, this might be wrong in the query normalization
    Anton Melser
    @AntonOfTheWoods

    Ok, now I can't promise there won't be bugs (it's still beta, after all) but if anyone is using pouch+idb and is synching to a graphql endpoint, then I can heartily suggest giving the dexie storage a go with the latest (12.4.1+) rxdb. You may need to tweak some queries (see my previous post) but... WOW! Particularly when compiled in production mode, I am seeing MASSIVE speed-ups across the board, anywhere from 2x to 10x. It was a bit clunky and slow before but I accepted it because I am using react-admin, and have a data driver that first goes through a proxy to a service worker and then all data access is done via the single service worker process in a second data access layer. But now with dexie and 12.4.1 (with a couple of tweaks) everything is now lightning fast, and I am now not regretting the extra couple of layers of complexity at all (which makes having web + chrome extension much easier to manage with a single codebase).

    Thanks again Mr Meyer for all your awesome work!

    kingjack05
    @kingjack05
    Do query on nested documents work if I did not define it in the schema? Something like db.inventory.find( { "size.uom": "in" } )? Link
    Anton Melser
    @AntonOfTheWoods
    Does anyone know if it is normal that await db.remove() with 12.4.1 and dexie storage will return a list of collections that have supposedly been deleted but that physically the indexeddb databases are still there, only emptied? I am pretty sure they used to get actually deleted with pouchdb-idb and rxdb 11.
    Maxime
    @mbret
    Hi guys, quick question about primary key. I am one of many who used the v9 and the automatic _id as primary key. Couple of month ago I tried to migrate to v10 but got an error because the library would not let me use _id (regex error). I tried today with v12 and I don't have the error anymore. I can set my primary key as _id. It looks like I can upgrade rxdb while having no migration to do (which is what I wanted). @pubkey Is it because you decided to allow _id to be used as primary again ? I remember asking why it was forbidden back in the day and afaik you were gonna consider it.
    Daniel Meyer
    @pubkey
    Yes, _id is allowed to make migration easier
    This was changed some time in the past
    Daniel Meyer
    @pubkey
    @AntonOfTheWoods not all storages allow it to dynamically add/remove collections to an imdexeddb database. So some just clear them to at least empty the disc space
    1 reply
    Divya Sai
    @Divyasaii_twitter
    Hi
    Can we use Rest API Replications if yes...may i know the creation and implementation of Replication in rxdb for React
    6 replies
    Maxime
    @mbret
    Thanks a lot pubkey, this is a very nice consideration
    Jimmy Merrild Krag
    @beruic
    Has anyone experienced TypeError: pouch.getIndexes is not a function?
    Jimmy Merrild Krag
    @beruic
    I found my issue. I'm upgrading from 11.6.0 to 12.4.1 and now getRxStoragePouch and new RxStoragePouch are no longer equivalent, because getRxStoragePouch adds some important plugins.
    Christian M. Austria
    @chan-dev

    May i know what's the query method to empty out a collection?
    I thought myCollection.bulkUpsert([]) would delete all contents but it simply ignores it by looking at the source code of the method.

    What i actually intend to do is simply replace the contents of the current collection, is the viable method simply remove all contents and insert the documents in the collection? Maybe i'm not aware of it, but is there a replace method?

    9 replies
    Jimmy Merrild Krag
    @beruic
    I kinda feel this room could benefit from moving to another place where we can have multiple channels or rooms for various topics. I imagined something like Discord or Slack. What are peoples thoughts on this?
    3 replies
    Ahmad Faizi
    @afazzdev
    How to use compound index? i keep getting error. it said the index can't be used
    { "error": "no_usable_index",
        "message": "There is no index available for this selector.",}
    The query is something like this
    {
            limit: line,
            skip: page === 1 ? 0 : (page - 1) * line,
            sort: [{ published_at: "desc" }, { id: "desc" }],
            index: ["id", "published_at"],
     }
    1 reply
    And the schema is something like this
    {
    indexes: ["id", "published_at", ["id", "published_at"]],
    }
    version i'm using
     {
    "rxdb": "^12.1.0",
    "rxjs": "^7.5.5",
    }
    Ahmad Faizi
    @afazzdev
    Btw.. i'm trying to use other pre-built worker db, but nothing seems to work except for Dexie. The lokijs has ensureNotFalsy() is falsy error and pouchdb has this error UT4: 'given leveldown is no valid adapter',. Is there something i miss again?
    Hugo Côrtes Lemos
    @hugo6467_gitlab
    image.png
    1 reply
    Anyone having trouble using rxdb with a quasar project?
    I keep getting this error when trying to import somethings, like use "addPouchPlugin"
    image.png
    Joe Woodhouse
    @joewoodhouse
    Anyone happen to know how much the Premium pricing is?
    Daniel Meyer
    @pubkey
    Pricing is not ready yet. Premium is at beta mode with some people testing it. You can fill out the premium request form
    Maxime
    @mbret
    I am getting a crash when using v12 with couchdb documents created for earlier version. It seems that rxdb requires something named rxdbMeta on documents to work and of course they dont have it. I tried to create a migration and add the property myself but then I have a crash saying that I am trying to add extra properties to the schema. I am not sure this is the proper way to migrate to new version, any idea ?
    Maxime
    @mbret
    After some investigation it looks like the pouch storage might have a bug, my code is trying to run the migration but the storage instance seems to expect the _meta object to already exists. Which make end crashing because of a dead situation. We try to write data to add the new prop but the writing method expect it to exists
    image.png
    Mohamed Ezzaouia
    @ezzaouia
    Hello everyone, I'm still new to rxdb.. is there a simple way for many-to-many / one-to-many relations. I have a USER collection and an ACTIVITY collection.. I would like to create a USER_ACTIVITY collection (in between), which I think will facilitate managing CRUD operations. Also, is there any cascading mechanism? Any thoughts? Thanks in advance.
    Maxime
    @mbret
    afaik there is no cascading mecanism but you can do it by implementing hooks https://rxdb.info/middleware.html. For relationships you have https://rxdb.info/population.html which might help you a bit
    4 replies
    Be careful with cascading tho, it can lead to bug hard to debug or impact integrity. Sometime it's better to never delete anything and keep dangling references. Since you cannot always ensure the db is synchronised between all clients / device, a dangling somewhere might not be a dangling somewhere else.
    1 reply
    Maxime
    @mbret
    @pubkey do you think I should create a ticket related to the issue I mentioned above ? it seems to be a probable bug in the storage provider
    Daniel Meyer
    @pubkey

    @mbret This is known. You can add the _meta field or use the migrateRxDBV11ToV12 plugin, but that is in the premium package.

    migrateRxDBV11ToV12 A plugin that migrates data from any RxDB v11 storage to a new RxDB v12 database. Use this when you upgrade from RxDB 11->12 and you have to keep your database state.

    It basically takes all documents from the old storage, adds missing _meta and inserts them into the new storage

    Using the migration plugin does not help, because also other data is missing that was stored in the internal collection of a database
    Maxime
    @mbret
    since I am migrating from v10 to v12 I am not sure I can use the premium package, unless you say otherwise ? I would consider buying to support you anyway. This would be a good opportunity. About the "You can add the _meta field", do you mean by a custom migration process ? if so when I try to add it I get the error that I posted.