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

Upsert Document with Attacment #494

Closed
yahyavi opened this issue Jan 26, 2018 · 3 comments
Closed

Upsert Document with Attacment #494

yahyavi opened this issue Jan 26, 2018 · 3 comments

Comments

@yahyavi
Copy link

yahyavi commented Jan 26, 2018

Case

Feature Request (didn't find any info on it in the documents)

Issue

I am looking for a way to upsert or atomicUpsert a document with an attachment in one go.
From my understanding right now I have to save a document and then do a put attachment (which is not atomic) and can potentially cause issues.

Info

  • Environment: browser
  • Adapter: IndexedDB/Localstorage
  • Stack: Typescript, React

Code

I am looking for something like this:

const fileAttachment = {
    id,     // string, name of the attachment like 'cat.jpg'
    data,   // (string|Blob|Buffer) data of the attachment
    type    // (string) type of the attachment-data like 'image/jpeg'
}
const docData = {
    name: 'Bob', // primary
    lastName: 'Kelso',
    attachment: fileAttachment,
};

myCollection.upsert(docData);
or 
myCollection.atomicUpsert(docData);
@pubkey
Copy link
Owner

pubkey commented Jan 29, 2018

Hi @yahyavi
There is currently no way to do this with rxdb. You could of course use the underlaying pouchdb as workarround. Of course it would be nice if this was possible directly with rxdb.
I will not have time in the near future to implement this.
Do you have the time to create a PR?

@yahyavi
Copy link
Author

yahyavi commented Jan 30, 2018

Hi @pubkey,
I will try to have a look but right now I am running into a bug and I cannot create DBs anymore. Will open a separate issue here with a minimal repo to replicate.

@pubkey
Copy link
Owner

pubkey commented Mar 9, 2018

I'm closing this because I do not think someone will implement it.
I added the feature-request to the backlog.

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

No branches or pull requests

2 participants