javascript - Update based on Timestamp in Firebase -
i'm having firebase db follows:
{ "page_id": { "user_1": { "messages": { "1502774604": { "timestamp": 1502774604, "user": false, "content": "hi" }, "1502774613": { "timestamp": 1502774613, "user": false, "content": "hello" }, "1502791814": { "timestamp": 1502791814, "user": false, "content": "how you" } } } } } i want set 'user' field 'true' timestamp less '1502791814'. possible in firebase?
the sql same
update messages set user = true timestamp <= 1502791814
ps: i'm using javascript client
please consider doing following:
firebase.database().ref('page_id/user1/messages').orderbychild('timestamp').endat(1502791814) .on('value',function(snap){ //now snap array of nodes wanted //each node can reached using following snap.foreach(function(eachsnap){ //complete here update stuff }); }); hope works!
Comments
Post a Comment