Skip to content
New issue

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

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

Already on GitHub? # to your account

Allow to perform set with additional parameters (e.g. { merge: true }) #1204

Closed
iclems opened this issue Oct 4, 2017 · 9 comments
Closed

Comments

@iclems
Copy link

iclems commented Oct 4, 2017

https://github.com/angular/angularfire2/blob/21133852c2cfcb2fc1402e63e8cddc0cff70d15c/src/firestore/document/document.ts#L52

@davideast
Copy link
Member

@iclems Want to send in the PR? :)

@iclems
Copy link
Author

iclems commented Oct 5, 2017

Sure! I always start by opening tickets to remember it myself ;-)

@codediodeio
Copy link
Contributor

On a related note, it looks like these methods require a plain object.
screen shot 2017-10-05 at 6 56 56 am

Is this expected or should the methods look like this?

return this.ref.update({ ...data });

@bergergit
Copy link

Any updates on this?
Being able to use { merge: true } is crucial

@jtomek
Copy link

jtomek commented Oct 14, 2017

Indeed this is a crucial feature.

var cityRef = db.collection('cities').doc('BJ');

var setWithMerge = cityRef.set({
    capital: true
}, { merge: true });

https://cloud.google.com/firestore/docs/manage-data/add-data

EDIT: It is possible to use the firebase ref endpoint:

this.afs.collection(`users/${variable}/collection`).doc("yourid").ref
 .set({
  capital: true
 }, { merge: true });

@hiepxanh
Copy link
Contributor

hiepxanh commented May 5, 2018

hello, is that problem resolved and we just only need update @jtomek solution to docs?

@codediodeio
Copy link
Contributor

codediodeio commented May 5, 2018

This issue has already been fixed with #1332. No need to use the workaround above. You can do it like this.

cityRef.set({ capital: 'sactown' }, { merge: true });

@hiepxanh
Copy link
Contributor

hiepxanh commented May 5, 2018

Yahoo! one more problem resolved. Can we close that issue @iclems 😄

@jamesdaniels
Copy link
Member

Fair. There's a work around with the new API now. Closing due to it being outdated.

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

No branches or pull requests

7 participants