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

Created on 4 Oct 2017  路  9Comments  路  Source: angular/angularfire

Most helpful comment

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 });

All 9 comments

@iclems Want to send in the PR? :)

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

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 });

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

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 });

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

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 });

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

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

Was this page helpful?
0 / 5 - 0 ratings