AND-OR conditions in firebase query Javascript -
couldn't found answers on google docs neither on stack, have ask this.
how hit query or condition in firebase servers.
basically, want check if specific chat conversation exist in database. chat can have 2 types of ids (steveandjacob or jacobandsteve), how can check if either 1 of them exist in db?
here code have wrote.
var currentuserid = localstorage.getitem('currentuserid'); var chatid = currentuserid+''+anotheruserid; var chatid2 = anotheruserid+''+currentuserid; var ref = firebase.database().ref('messages/conv').orderbychild('chatid').equalto(chatid); ref.on('value', function(snapshot) { if (snapshot.exists()) alert ("exist"); else alert ("not exist"); });
how done?
Comments
Post a Comment