Firebase / AngularFire limited object deletes its properties on $save() -
i have primary node in database called 'questions', when create ref node , bring project $asobject(), can modify individual questions , $save() collection without problems, seek limit object, priority, $save() deletes off of object!
this works fine:
db.questions = $firebase(fb.questions).$asobject(); // later : db.questions.$save(); // db.questions object many 'questions', can edit , resave please
but switch code this:
db.questions = $firebase(fb.questions.startat(auth.user.id).endat(auth.user.id)).$asobject(); // later : db.questions.$save(); // db.questions empty firebase object without 'questions!'
is there limitation limited objects (pun not intended) , ability changed , saved?? saving saves updates questions database, somehow nukes local $firebase object...
first line of synchronized arrays ($asarray
) documentation:
synchronized arrays should used list of objects sorted, iterated, , have unique ids.
first line of synchronized objects ($asobject
) documentation:
objects useful storing key/value pairs, , singular records not used collection.
as demonstrated, if going work collection , employ limit
, behoove utilize tool designed collections (i.e. $asarray).
if recreate behavior of $save
using firebase sdk, this:
var ref = new firebase(url).limit(10); // ref.set(data); // throws error! ref.ref().set(data); // replaces entire path; same $save
thus, behavior here matches sdk. cannot, technically, phone call set() on query instance , doesn't create sense, really. limit(10) mean json object? if phone call set, 10 unordered keys should set? there no correlation here , limit() makes sense collection of data, not list of key/value pairs.
hope helps.
firebase angularfire
No comments:
Post a Comment