angularfire icon indicating copy to clipboard operation
angularfire copied to clipboard

Feature Request: Array Operations

Open JonesM87 opened this issue 8 years ago • 5 comments

Will there be support for the newer array operations?

From the docs:

var washingtonRef = db.collection("cities").doc("DC");

// Atomically add a new region to the "regions" array field.
washingtonRef.update({
    regions: firebase.firestore.FieldValue.arrayUnion("greater_virginia")
});

// Atomically remove a region from the "regions" array field.
washingtonRef.update({
    regions: firebase.firestore.FieldValue.arrayRemove("east_coast")
});

https://firebase.google.com/docs/firestore/manage-data/add-data#update_elements_in_an_array

JonesM87 avatar Sep 15 '18 18:09 JonesM87

@JonesM87 Did you find a workaround for this in the meantime?

1001daysofcode avatar Sep 16 '18 19:09 1001daysofcode

@troydcthompson I just stored the field data/array locally, made any manipulations I needed to, then updated the doc field. The arrays I'm manipulation are pretty small so this seems ok for now but does mean an additional read from the db.

JonesM87 avatar Sep 16 '18 20:09 JonesM87

All this works w/AngularFire, you'll just need to update your Firebase/Firestore dependencies.

jamesdaniels avatar Sep 20 '18 23:09 jamesdaniels

import firebase from 'firebase/app' needs to be imported as well?

erperejildo avatar Oct 14 '18 18:10 erperejildo

I am also facing this array update issue how to do that using angular fire

LakshanKarunathilake avatar May 11 '19 14:05 LakshanKarunathilake