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

when use bulkInsert to insert doc, the rxDocument property on changeEvent is an object, not a RxDocument instance #2705

Closed
qinyang912 opened this issue Nov 23, 2020 · 4 comments

Comments

@qinyang912
Copy link
Contributor

Case

Bug

Issue

when use bulkInsert to insert doc, the rxDocument property on changeEvent is an object, not a RxDocument instance

Info

  • Environment: browser
  • Adapter: memory
  • Stack: Typescript

Code

import { createRxDatabase, addRxPlugin } from "rxdb";
import PouchAdapterMemory from "pouchdb-adapter-memory";

addRxPlugin(PouchAdapterMemory);

async function test() {
  const db = await createRxDatabase({
    name: "test",
    adapter: "memory",
    eventReduce: false
  });

  await db.collection({
    name: "tasks",
    schema: {
      title: "task",
      version: 0,
      type: "object",
      properties: {
        id: {
          type: "string",
          primary: true
        },
        name: {
          type: "string"
        }
      }
    }
  });

  db.tasks.insert$.subscribe(changeEvent =>
    console.log("changeEvent.rxDocument", changeEvent.rxDocument)
  );

  await db.tasks.bulkInsert([{ id: "1", name: "test" }]);
}
test();

https://stackblitz.com/edit/rxdb-bulkinsert-xqjfud?file=index.ts

@pubkey
Copy link
Owner

pubkey commented Nov 23, 2020

Yes, this is a bug.

@pubkey
Copy link
Owner

pubkey commented Dec 13, 2020

Can you make a pull request?

@qinyang912
Copy link
Contributor Author

@pubkey I have opened a pull request #2752

@pubkey pubkey closed this as completed Dec 19, 2020
@pubkey
Copy link
Owner

pubkey commented Dec 19, 2020

Merged.

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