how to make a select query to firebase
Date : March 29 2020, 07:55 AM
this will help When you access Firebase through most of its APIs, it will always retrieve complete nodes. So you can not tell it to retrieve only a subset of the properties. That means that if you really only want the titles, you'll have to model your data differently. Right now you have something like this: posts
-Jas73489342
title: "how to make a select query using firebase"
text: "...."
-Jasa8324023
title: "bicycling the grand canyon"
text: "..."
titles
-Jas73489342: "how to make a select query using firebase"
-Jasa8324023: "bicycling the grand canyon"
texts
-Jas73489342: "...."
-Jasa8324023: "..."
var ref = new Firebase(FBURL),
titles = ref.child('titles'),
texts = ref.child('texts'),
item = { title: 'Petroglyphs in Albuquerqe', text: '...' };
var newItemRef = texts.push(item.text);
var key = newItemRef.key();
var newTitleRef = titles.child(key).set(item.title);
|
Query on multiple values in Firebase, similar to IN() SQL functionality
Date : March 29 2020, 07:55 AM
this one helps. Here is how I eventually did it: With the foreach command you can easily manipulate data and then push it into an array to re-create a collection of data however you need it. $scope.validZipCodes = [];
$scope.validContractorJobs = [];
var Jobs = firebase.child('Jobs');
contractorJobs.on('value', function(snap) {
snap.forEach(function(job) {
angular.forEach($scope.validZipCodes, function(value, key) {
if(job.val().ZipCode == value) {
$scope.validContractorJobs.push(job.val());
}
});
});
});
|
Is there a way to do 'query execution plan ' in Firebase database? Similar to the usage of explain() in MongoDB?
Date : March 29 2020, 07:55 AM
wish of those help There is no query execution explanation in Firebase Database. To be honest, the types of queries you can currently build on the database are limited. So such a tool would be fairly static. If you're not getting the results you expect or the performance you expect, share the minimal code to reproduce the problem and we'll help from there.
|
How to make query to my Firebase database?
Tag : java , By : Alex Bartzas
Date : March 29 2020, 07:55 AM
fixed the issue. Will look into that further I need make query to my database . , To solve this, please change the following line of code: return databaseReference.child("songsDB")
.orderByChild("stars")
.orderByValue(getUID())
.equalTo(true);
return databaseReference.child("songsDB")
.orderByChild("stars/" + getUID())
.equalTo(true);
|
How do you make a function that has to do a query on the firebase database and return the value of the query as an int?
Tag : ios , By : Willem van Schevikho
Date : March 29 2020, 07:55 AM
This might help you You don't. To get the asynchronous operation result you use blocks. static func getTilesPerRow (@escaping completion: (Int?)->Void ) {
let user = Auth.auth().currentUser
guard let uid = user?.uid else {
completion(nil)
}
var ref: DatabaseReference!
ref = Database.database().reference()
let userRef = ref.child("user").child(uid)
userRef.child("tilesPerRow").observeSingleEvent(DataEventType.value, with: { (snapshot) in
// Get user value
print("now inside the observe thing------------------")
let value = snapshot.value as? NSDictionary
let num = snapshot.value as? Int ?? 0
completion(num)
}) { (error) in
print("there was an error!!!!!!!!!!!!!!!!!")
print(error.localizedDescription)
completion(nil)
}
}
|