Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Push batchSize in not respected #3994

Closed
meabed opened this issue Sep 26, 2022 · 10 comments
Closed

Push batchSize in not respected #3994

meabed opened this issue Sep 26, 2022 · 10 comments

Comments

@meabed
Copy link

meabed commented Sep 26, 2022

Thank you so much for the new release, it's working great with couple of minor issues:

  • When adding batchSize 1 to the push handler and doing multiple rows updates fast ( in forloop for example ) the docs are passing sometimes in batchsize correctly and sometimes in more than batchsize ( incorrectly )
  • Boolean fields that are used in an index, must be required, is not working as its not reading the variable from the schema path properly and throwing an error that field is not correct in the schema.

RxDB version: 13.3.0 used in ReactNative and PouchDB

Thank you so much

@pubkey
Copy link
Owner

pubkey commented Sep 26, 2022

Pls make a PR with a test case to reproduce. I cannot touch bugs that are not reproduced.

@meabed
Copy link
Author

meabed commented Sep 26, 2022

Pls make a PR with a test case to reproduce. I cannot touch bugs that are not reproduced.

Thank you @pubkey appreciate your reply, I will share this shortly.

@meabed
Copy link
Author

meabed commented Sep 27, 2022

Thank you @pubkey I have put a simple nextjs app to demo it (https://github.com/meabed/rxdb-nextjs-demo-todo):

image

On codesandbox ( https://codesandbox.io/s/github/meabed/rxdb-nextjs-demo-todofile=/src/components/todo.tsx ):
image

I have added 10 db rows ( todos ) and as you see in the screenshot, the first item fires correctly at 1 batchSize, next push is 8 docs all together.

@meabed meabed changed the title Push batchSize in not respected & Boolean required index is not found in the schema properly Push batchSize in not respected Sep 27, 2022
@pubkey pubkey closed this as completed in f0115ca Sep 27, 2022
@pubkey
Copy link
Owner

pubkey commented Sep 27, 2022

I fixed the batchSize problem so that it is respected now.
Please also make a unit test for the boolean field problem so I will work on a fix for that.

@meabed
Copy link
Author

meabed commented Sep 27, 2022

Thank you so much @pubkey 🙏

Yes I will re-produce the boolean field and open an issue, I tried on nextjs it was working, for react native it wasn't working, I will check if this issue still persists.

@meabed
Copy link
Author

meabed commented Sep 27, 2022

I have the error here ( i will post a code to reproduce it ):
And you see the schema has both index and required:


ERROR : error creating collections RxError (SC38):
Fields of type boolean that are used in an index, must be required in the schema
Given parameters: {
index:"isNew"
field:"isNew"
schema:{
  "keyCompression": false,
  "version": 1,
  "primaryKey": "_id",
  "type": "object",
  "properties": {
    "_id": {
      "type": "string",
      "maxLength": 100
    },
    "data": {
      "type": "object"
    },
    "isNew": {
      "type": "boolean",
      "default": false
    },
    "createdAt": {
      "type": "string",
      "format": "date-time",
      "maxLength": 24
    },
    "updatedAt": {
      "type": "string",
      "format": "date-time",
      "maxLength": 24
    }
  },
  "required": [
    "_id",
    "data",
    "createdAt",
    "updatedAt",
    "isNew"
  ],
  "indexes": [
    "createdAt",
    "updatedAt",
    "isNew"
  ]
}}

@pubkey
Copy link
Owner

pubkey commented Sep 27, 2022

Ah I see. Thats good enough to reproduce, I will fix.

@pubkey
Copy link
Owner

pubkey commented Sep 27, 2022

Fixed here: 75ca7c1
Are you sure that your schema version should be 1 ?
If you create a collection for the first time, start with version 0

@meabed
Copy link
Author

meabed commented Sep 27, 2022

Got it, I think when I used 0 I had another issue In the migration Plug-in I will verify and let you know.

Appreciate your support ❤️

@meabed
Copy link
Author

meabed commented Sep 28, 2022

@pubkey Would you be planning to release this fixes soon?
Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants