How to search a value in Firebase IOS












-1















I've got a problem with queryOrdered() function, I don't know really how to deal with...



Assuming my database structure is :



Planes{
Uid{
SE{
AutoID{
.Auto-Id
.Picture
.Registration
.Type
.model
}
AutoID{
//Same as first one
}
}
ME{
AutoID{
//Same as first one
}
}
}}


In this part of my Database I would like to run a search by .Registration



So I've been set my reference to Planes > UId



And after do this code :



var acftPickerSelected = aircrafts[listAcftsPicker.selectedRow(inComponent: 0)]

if let user = Auth.auth().currentUser{
// user is connect
let ref = Database.database().reference()
let userID = Auth.auth().currentUser?.uid

let ev = ref.child("Planes").child(userID!)

ev.queryOrdered(byChild: "Registration").queryEqual(toValue: acftPickerSelected).observeSingleEvent(of: .value) { (snapshot: DataSnapshot) in
for child in snapshot.children {
let value = snapshot.value as? NSDictionary

self.pickerRegi = value?["Registration"] as? String ?? "..unknown.."
self.stdbPickerType = value?["Type"] as? String ?? "..unknown.."
self.pickerModel = value?["model"] as? String ?? "..unknown.."

print("Avion : (self.pickerRegi) - (self.pickerModel) - (self.stdbPickerType)")
}
}


But this message appears :




2018-11-27 18:03:54.797824+0100 XXXXXXXXXX[12954:527986] 5.10.0 - [Firebase/Database][I-RDB034028] Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ".indexOn": "Registration" at /Planes/BJMhmQzJXldULc5X9Y2WzjFEs9a2 to your security rules for better performance




So I've been add the rules on firebase like this :



{"rules": {
"Planes":{
"$uid":{
".indexOn": ["Registration"],
".write": "$uid === auth.uid",
".read": "$uid === auth.uid"
}
},
".read": true,
".write": true}}


And now the error message didn't appear anymore but nothing happen in this part :



self.pickerRegi = value?["Registration"] as? String ?? "..unknown.."
self.stdbPickerType = value?["Type"] as? String ?? "..unknown.."
self.pickerModel = value?["model"] as? String ?? "..unknown.."

print("Avion : (self.pickerRegi) - (self.pickerModel) - (self.stdbPickerType)")


How can I fix it?



Thanks for your help.










share|improve this question




















  • 1





    Possible duplicate of Firebase warning: Using an unspecified index when search data with Firebase Cloud Function

    – Callam
    Nov 27 '18 at 17:21






  • 1





    @Callam That's a good link but not a duplicate as the OP resolved the issue as noted in the post and it's not the root cause of the problem.

    – Jay
    Nov 27 '18 at 20:29
















-1















I've got a problem with queryOrdered() function, I don't know really how to deal with...



Assuming my database structure is :



Planes{
Uid{
SE{
AutoID{
.Auto-Id
.Picture
.Registration
.Type
.model
}
AutoID{
//Same as first one
}
}
ME{
AutoID{
//Same as first one
}
}
}}


In this part of my Database I would like to run a search by .Registration



So I've been set my reference to Planes > UId



And after do this code :



var acftPickerSelected = aircrafts[listAcftsPicker.selectedRow(inComponent: 0)]

if let user = Auth.auth().currentUser{
// user is connect
let ref = Database.database().reference()
let userID = Auth.auth().currentUser?.uid

let ev = ref.child("Planes").child(userID!)

ev.queryOrdered(byChild: "Registration").queryEqual(toValue: acftPickerSelected).observeSingleEvent(of: .value) { (snapshot: DataSnapshot) in
for child in snapshot.children {
let value = snapshot.value as? NSDictionary

self.pickerRegi = value?["Registration"] as? String ?? "..unknown.."
self.stdbPickerType = value?["Type"] as? String ?? "..unknown.."
self.pickerModel = value?["model"] as? String ?? "..unknown.."

print("Avion : (self.pickerRegi) - (self.pickerModel) - (self.stdbPickerType)")
}
}


But this message appears :




2018-11-27 18:03:54.797824+0100 XXXXXXXXXX[12954:527986] 5.10.0 - [Firebase/Database][I-RDB034028] Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ".indexOn": "Registration" at /Planes/BJMhmQzJXldULc5X9Y2WzjFEs9a2 to your security rules for better performance




So I've been add the rules on firebase like this :



{"rules": {
"Planes":{
"$uid":{
".indexOn": ["Registration"],
".write": "$uid === auth.uid",
".read": "$uid === auth.uid"
}
},
".read": true,
".write": true}}


And now the error message didn't appear anymore but nothing happen in this part :



self.pickerRegi = value?["Registration"] as? String ?? "..unknown.."
self.stdbPickerType = value?["Type"] as? String ?? "..unknown.."
self.pickerModel = value?["model"] as? String ?? "..unknown.."

print("Avion : (self.pickerRegi) - (self.pickerModel) - (self.stdbPickerType)")


How can I fix it?



Thanks for your help.










share|improve this question




















  • 1





    Possible duplicate of Firebase warning: Using an unspecified index when search data with Firebase Cloud Function

    – Callam
    Nov 27 '18 at 17:21






  • 1





    @Callam That's a good link but not a duplicate as the OP resolved the issue as noted in the post and it's not the root cause of the problem.

    – Jay
    Nov 27 '18 at 20:29














-1












-1








-1








I've got a problem with queryOrdered() function, I don't know really how to deal with...



Assuming my database structure is :



Planes{
Uid{
SE{
AutoID{
.Auto-Id
.Picture
.Registration
.Type
.model
}
AutoID{
//Same as first one
}
}
ME{
AutoID{
//Same as first one
}
}
}}


In this part of my Database I would like to run a search by .Registration



So I've been set my reference to Planes > UId



And after do this code :



var acftPickerSelected = aircrafts[listAcftsPicker.selectedRow(inComponent: 0)]

if let user = Auth.auth().currentUser{
// user is connect
let ref = Database.database().reference()
let userID = Auth.auth().currentUser?.uid

let ev = ref.child("Planes").child(userID!)

ev.queryOrdered(byChild: "Registration").queryEqual(toValue: acftPickerSelected).observeSingleEvent(of: .value) { (snapshot: DataSnapshot) in
for child in snapshot.children {
let value = snapshot.value as? NSDictionary

self.pickerRegi = value?["Registration"] as? String ?? "..unknown.."
self.stdbPickerType = value?["Type"] as? String ?? "..unknown.."
self.pickerModel = value?["model"] as? String ?? "..unknown.."

print("Avion : (self.pickerRegi) - (self.pickerModel) - (self.stdbPickerType)")
}
}


But this message appears :




2018-11-27 18:03:54.797824+0100 XXXXXXXXXX[12954:527986] 5.10.0 - [Firebase/Database][I-RDB034028] Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ".indexOn": "Registration" at /Planes/BJMhmQzJXldULc5X9Y2WzjFEs9a2 to your security rules for better performance




So I've been add the rules on firebase like this :



{"rules": {
"Planes":{
"$uid":{
".indexOn": ["Registration"],
".write": "$uid === auth.uid",
".read": "$uid === auth.uid"
}
},
".read": true,
".write": true}}


And now the error message didn't appear anymore but nothing happen in this part :



self.pickerRegi = value?["Registration"] as? String ?? "..unknown.."
self.stdbPickerType = value?["Type"] as? String ?? "..unknown.."
self.pickerModel = value?["model"] as? String ?? "..unknown.."

print("Avion : (self.pickerRegi) - (self.pickerModel) - (self.stdbPickerType)")


How can I fix it?



Thanks for your help.










share|improve this question
















I've got a problem with queryOrdered() function, I don't know really how to deal with...



Assuming my database structure is :



Planes{
Uid{
SE{
AutoID{
.Auto-Id
.Picture
.Registration
.Type
.model
}
AutoID{
//Same as first one
}
}
ME{
AutoID{
//Same as first one
}
}
}}


In this part of my Database I would like to run a search by .Registration



So I've been set my reference to Planes > UId



And after do this code :



var acftPickerSelected = aircrafts[listAcftsPicker.selectedRow(inComponent: 0)]

if let user = Auth.auth().currentUser{
// user is connect
let ref = Database.database().reference()
let userID = Auth.auth().currentUser?.uid

let ev = ref.child("Planes").child(userID!)

ev.queryOrdered(byChild: "Registration").queryEqual(toValue: acftPickerSelected).observeSingleEvent(of: .value) { (snapshot: DataSnapshot) in
for child in snapshot.children {
let value = snapshot.value as? NSDictionary

self.pickerRegi = value?["Registration"] as? String ?? "..unknown.."
self.stdbPickerType = value?["Type"] as? String ?? "..unknown.."
self.pickerModel = value?["model"] as? String ?? "..unknown.."

print("Avion : (self.pickerRegi) - (self.pickerModel) - (self.stdbPickerType)")
}
}


But this message appears :




2018-11-27 18:03:54.797824+0100 XXXXXXXXXX[12954:527986] 5.10.0 - [Firebase/Database][I-RDB034028] Using an unspecified index. Your data will be downloaded and filtered on the client. Consider adding ".indexOn": "Registration" at /Planes/BJMhmQzJXldULc5X9Y2WzjFEs9a2 to your security rules for better performance




So I've been add the rules on firebase like this :



{"rules": {
"Planes":{
"$uid":{
".indexOn": ["Registration"],
".write": "$uid === auth.uid",
".read": "$uid === auth.uid"
}
},
".read": true,
".write": true}}


And now the error message didn't appear anymore but nothing happen in this part :



self.pickerRegi = value?["Registration"] as? String ?? "..unknown.."
self.stdbPickerType = value?["Type"] as? String ?? "..unknown.."
self.pickerModel = value?["model"] as? String ?? "..unknown.."

print("Avion : (self.pickerRegi) - (self.pickerModel) - (self.stdbPickerType)")


How can I fix it?



Thanks for your help.







ios swift firebase firebase-realtime-database






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Dec 2 '18 at 22:02









André Kool

3,39792640




3,39792640










asked Nov 27 '18 at 17:16









flyer74flyer74

678




678








  • 1





    Possible duplicate of Firebase warning: Using an unspecified index when search data with Firebase Cloud Function

    – Callam
    Nov 27 '18 at 17:21






  • 1





    @Callam That's a good link but not a duplicate as the OP resolved the issue as noted in the post and it's not the root cause of the problem.

    – Jay
    Nov 27 '18 at 20:29














  • 1





    Possible duplicate of Firebase warning: Using an unspecified index when search data with Firebase Cloud Function

    – Callam
    Nov 27 '18 at 17:21






  • 1





    @Callam That's a good link but not a duplicate as the OP resolved the issue as noted in the post and it's not the root cause of the problem.

    – Jay
    Nov 27 '18 at 20:29








1




1





Possible duplicate of Firebase warning: Using an unspecified index when search data with Firebase Cloud Function

– Callam
Nov 27 '18 at 17:21





Possible duplicate of Firebase warning: Using an unspecified index when search data with Firebase Cloud Function

– Callam
Nov 27 '18 at 17:21




1




1





@Callam That's a good link but not a duplicate as the OP resolved the issue as noted in the post and it's not the root cause of the problem.

– Jay
Nov 27 '18 at 20:29





@Callam That's a good link but not a duplicate as the OP resolved the issue as noted in the post and it's not the root cause of the problem.

– Jay
Nov 27 '18 at 20:29












1 Answer
1






active

oldest

votes


















0














There are two things going on here;




  1. indexOn

  2. The observer


and in this case, the indexOn is not the issue.



The indexOn is most important in a production app and it's basically a performance increase for queries. For testing, eliminate that variable first as it's not the cause of the issue. Reset the rules to default temporarily



{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}


The real issue is the observe as it's not deep enough to reach the data you're trying to get to. You're missing the 'SE' level. Here's a re-write



let uidRef = ref.child("Planes").child(userID)
let seRef = uidRef.child("SE") //this is the child node to query
seRef.queryOrdered(byChild: "Registration").queryEqual(toValue: acftPickerSelected)
.observeSingleEvent(of: .value) { snapshot in
for child in snapshot.children {
let childSnap = child as! DataSnapshot
let dict = childSnap.value as! [String: Any]
let reg = dict["Registration"] as? String ?? "No Reg"
let mod = dict["model"] as? String ?? "No Model"
print(reg, mod)
}
}


the way it's written in your question, the query will query the next level up: it's expecting to find a Registration node directly under the SE and ME nodes. But those nodes only contain the autoId nodes.



EDIT:



Changing the structure by flattening (denormalizing) it would also be another option



Planes
Uid
AutoID
.Auto-Id //note, if the is the same as the key, its not needed
.Picture
.Registration
.Type
.model
.se_or_me: "SE"
AutoID
.Auto-Id
.Picture
.Registration
.Type
.model
.se_or_me: "ME"





share|improve this answer


























  • Thanks, so as I need to check both folder (SE & ME) at the same time I need to do two check one for the SE folder and one for the ME folder ?

    – flyer74
    Nov 27 '18 at 21:02











  • @flyer74 With your current structure, that is correct. I don't know why there are two nodes (SE and ME) so it may simply be a matter of changing your structure to make it flatter (demormalizing) and include that as a child node instead of making it a parent node. So within the uid parent node you would have each child node include what you have now, .picture and .registration etc but also have a .se_or_me: "SE" or .se_or_me: "ME". I added an edit to my answer to demonstrate that structure.

    – Jay
    Nov 28 '18 at 18:31













  • Thank for your answer, I'll try it but I also have a TableView in an other View witch is divided by 2 sections one for SE and one for ME I need to modify this section also ..

    – flyer74
    Dec 2 '18 at 17:21











  • @flyer74 If you opt to change your structure to include a .se_or_me child then it won't matter because the child nodes contain SE or ME so you would know which it belongs to or can filter by that child node.

    – Jay
    Dec 2 '18 at 19:51






  • 1





    @flyer74 Awesome! I am glad it helped. Be sure to accept the answer so it can help others as well!

    – Jay
    Dec 4 '18 at 13:00











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53504884%2fhow-to-search-a-value-in-firebase-ios%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














There are two things going on here;




  1. indexOn

  2. The observer


and in this case, the indexOn is not the issue.



The indexOn is most important in a production app and it's basically a performance increase for queries. For testing, eliminate that variable first as it's not the cause of the issue. Reset the rules to default temporarily



{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}


The real issue is the observe as it's not deep enough to reach the data you're trying to get to. You're missing the 'SE' level. Here's a re-write



let uidRef = ref.child("Planes").child(userID)
let seRef = uidRef.child("SE") //this is the child node to query
seRef.queryOrdered(byChild: "Registration").queryEqual(toValue: acftPickerSelected)
.observeSingleEvent(of: .value) { snapshot in
for child in snapshot.children {
let childSnap = child as! DataSnapshot
let dict = childSnap.value as! [String: Any]
let reg = dict["Registration"] as? String ?? "No Reg"
let mod = dict["model"] as? String ?? "No Model"
print(reg, mod)
}
}


the way it's written in your question, the query will query the next level up: it's expecting to find a Registration node directly under the SE and ME nodes. But those nodes only contain the autoId nodes.



EDIT:



Changing the structure by flattening (denormalizing) it would also be another option



Planes
Uid
AutoID
.Auto-Id //note, if the is the same as the key, its not needed
.Picture
.Registration
.Type
.model
.se_or_me: "SE"
AutoID
.Auto-Id
.Picture
.Registration
.Type
.model
.se_or_me: "ME"





share|improve this answer


























  • Thanks, so as I need to check both folder (SE & ME) at the same time I need to do two check one for the SE folder and one for the ME folder ?

    – flyer74
    Nov 27 '18 at 21:02











  • @flyer74 With your current structure, that is correct. I don't know why there are two nodes (SE and ME) so it may simply be a matter of changing your structure to make it flatter (demormalizing) and include that as a child node instead of making it a parent node. So within the uid parent node you would have each child node include what you have now, .picture and .registration etc but also have a .se_or_me: "SE" or .se_or_me: "ME". I added an edit to my answer to demonstrate that structure.

    – Jay
    Nov 28 '18 at 18:31













  • Thank for your answer, I'll try it but I also have a TableView in an other View witch is divided by 2 sections one for SE and one for ME I need to modify this section also ..

    – flyer74
    Dec 2 '18 at 17:21











  • @flyer74 If you opt to change your structure to include a .se_or_me child then it won't matter because the child nodes contain SE or ME so you would know which it belongs to or can filter by that child node.

    – Jay
    Dec 2 '18 at 19:51






  • 1





    @flyer74 Awesome! I am glad it helped. Be sure to accept the answer so it can help others as well!

    – Jay
    Dec 4 '18 at 13:00
















0














There are two things going on here;




  1. indexOn

  2. The observer


and in this case, the indexOn is not the issue.



The indexOn is most important in a production app and it's basically a performance increase for queries. For testing, eliminate that variable first as it's not the cause of the issue. Reset the rules to default temporarily



{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}


The real issue is the observe as it's not deep enough to reach the data you're trying to get to. You're missing the 'SE' level. Here's a re-write



let uidRef = ref.child("Planes").child(userID)
let seRef = uidRef.child("SE") //this is the child node to query
seRef.queryOrdered(byChild: "Registration").queryEqual(toValue: acftPickerSelected)
.observeSingleEvent(of: .value) { snapshot in
for child in snapshot.children {
let childSnap = child as! DataSnapshot
let dict = childSnap.value as! [String: Any]
let reg = dict["Registration"] as? String ?? "No Reg"
let mod = dict["model"] as? String ?? "No Model"
print(reg, mod)
}
}


the way it's written in your question, the query will query the next level up: it's expecting to find a Registration node directly under the SE and ME nodes. But those nodes only contain the autoId nodes.



EDIT:



Changing the structure by flattening (denormalizing) it would also be another option



Planes
Uid
AutoID
.Auto-Id //note, if the is the same as the key, its not needed
.Picture
.Registration
.Type
.model
.se_or_me: "SE"
AutoID
.Auto-Id
.Picture
.Registration
.Type
.model
.se_or_me: "ME"





share|improve this answer


























  • Thanks, so as I need to check both folder (SE & ME) at the same time I need to do two check one for the SE folder and one for the ME folder ?

    – flyer74
    Nov 27 '18 at 21:02











  • @flyer74 With your current structure, that is correct. I don't know why there are two nodes (SE and ME) so it may simply be a matter of changing your structure to make it flatter (demormalizing) and include that as a child node instead of making it a parent node. So within the uid parent node you would have each child node include what you have now, .picture and .registration etc but also have a .se_or_me: "SE" or .se_or_me: "ME". I added an edit to my answer to demonstrate that structure.

    – Jay
    Nov 28 '18 at 18:31













  • Thank for your answer, I'll try it but I also have a TableView in an other View witch is divided by 2 sections one for SE and one for ME I need to modify this section also ..

    – flyer74
    Dec 2 '18 at 17:21











  • @flyer74 If you opt to change your structure to include a .se_or_me child then it won't matter because the child nodes contain SE or ME so you would know which it belongs to or can filter by that child node.

    – Jay
    Dec 2 '18 at 19:51






  • 1





    @flyer74 Awesome! I am glad it helped. Be sure to accept the answer so it can help others as well!

    – Jay
    Dec 4 '18 at 13:00














0












0








0







There are two things going on here;




  1. indexOn

  2. The observer


and in this case, the indexOn is not the issue.



The indexOn is most important in a production app and it's basically a performance increase for queries. For testing, eliminate that variable first as it's not the cause of the issue. Reset the rules to default temporarily



{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}


The real issue is the observe as it's not deep enough to reach the data you're trying to get to. You're missing the 'SE' level. Here's a re-write



let uidRef = ref.child("Planes").child(userID)
let seRef = uidRef.child("SE") //this is the child node to query
seRef.queryOrdered(byChild: "Registration").queryEqual(toValue: acftPickerSelected)
.observeSingleEvent(of: .value) { snapshot in
for child in snapshot.children {
let childSnap = child as! DataSnapshot
let dict = childSnap.value as! [String: Any]
let reg = dict["Registration"] as? String ?? "No Reg"
let mod = dict["model"] as? String ?? "No Model"
print(reg, mod)
}
}


the way it's written in your question, the query will query the next level up: it's expecting to find a Registration node directly under the SE and ME nodes. But those nodes only contain the autoId nodes.



EDIT:



Changing the structure by flattening (denormalizing) it would also be another option



Planes
Uid
AutoID
.Auto-Id //note, if the is the same as the key, its not needed
.Picture
.Registration
.Type
.model
.se_or_me: "SE"
AutoID
.Auto-Id
.Picture
.Registration
.Type
.model
.se_or_me: "ME"





share|improve this answer















There are two things going on here;




  1. indexOn

  2. The observer


and in this case, the indexOn is not the issue.



The indexOn is most important in a production app and it's basically a performance increase for queries. For testing, eliminate that variable first as it's not the cause of the issue. Reset the rules to default temporarily



{
"rules": {
".read": "auth != null",
".write": "auth != null"
}
}


The real issue is the observe as it's not deep enough to reach the data you're trying to get to. You're missing the 'SE' level. Here's a re-write



let uidRef = ref.child("Planes").child(userID)
let seRef = uidRef.child("SE") //this is the child node to query
seRef.queryOrdered(byChild: "Registration").queryEqual(toValue: acftPickerSelected)
.observeSingleEvent(of: .value) { snapshot in
for child in snapshot.children {
let childSnap = child as! DataSnapshot
let dict = childSnap.value as! [String: Any]
let reg = dict["Registration"] as? String ?? "No Reg"
let mod = dict["model"] as? String ?? "No Model"
print(reg, mod)
}
}


the way it's written in your question, the query will query the next level up: it's expecting to find a Registration node directly under the SE and ME nodes. But those nodes only contain the autoId nodes.



EDIT:



Changing the structure by flattening (denormalizing) it would also be another option



Planes
Uid
AutoID
.Auto-Id //note, if the is the same as the key, its not needed
.Picture
.Registration
.Type
.model
.se_or_me: "SE"
AutoID
.Auto-Id
.Picture
.Registration
.Type
.model
.se_or_me: "ME"






share|improve this answer














share|improve this answer



share|improve this answer








edited Nov 28 '18 at 18:35

























answered Nov 27 '18 at 20:28









JayJay

19.1k43152




19.1k43152













  • Thanks, so as I need to check both folder (SE & ME) at the same time I need to do two check one for the SE folder and one for the ME folder ?

    – flyer74
    Nov 27 '18 at 21:02











  • @flyer74 With your current structure, that is correct. I don't know why there are two nodes (SE and ME) so it may simply be a matter of changing your structure to make it flatter (demormalizing) and include that as a child node instead of making it a parent node. So within the uid parent node you would have each child node include what you have now, .picture and .registration etc but also have a .se_or_me: "SE" or .se_or_me: "ME". I added an edit to my answer to demonstrate that structure.

    – Jay
    Nov 28 '18 at 18:31













  • Thank for your answer, I'll try it but I also have a TableView in an other View witch is divided by 2 sections one for SE and one for ME I need to modify this section also ..

    – flyer74
    Dec 2 '18 at 17:21











  • @flyer74 If you opt to change your structure to include a .se_or_me child then it won't matter because the child nodes contain SE or ME so you would know which it belongs to or can filter by that child node.

    – Jay
    Dec 2 '18 at 19:51






  • 1





    @flyer74 Awesome! I am glad it helped. Be sure to accept the answer so it can help others as well!

    – Jay
    Dec 4 '18 at 13:00



















  • Thanks, so as I need to check both folder (SE & ME) at the same time I need to do two check one for the SE folder and one for the ME folder ?

    – flyer74
    Nov 27 '18 at 21:02











  • @flyer74 With your current structure, that is correct. I don't know why there are two nodes (SE and ME) so it may simply be a matter of changing your structure to make it flatter (demormalizing) and include that as a child node instead of making it a parent node. So within the uid parent node you would have each child node include what you have now, .picture and .registration etc but also have a .se_or_me: "SE" or .se_or_me: "ME". I added an edit to my answer to demonstrate that structure.

    – Jay
    Nov 28 '18 at 18:31













  • Thank for your answer, I'll try it but I also have a TableView in an other View witch is divided by 2 sections one for SE and one for ME I need to modify this section also ..

    – flyer74
    Dec 2 '18 at 17:21











  • @flyer74 If you opt to change your structure to include a .se_or_me child then it won't matter because the child nodes contain SE or ME so you would know which it belongs to or can filter by that child node.

    – Jay
    Dec 2 '18 at 19:51






  • 1





    @flyer74 Awesome! I am glad it helped. Be sure to accept the answer so it can help others as well!

    – Jay
    Dec 4 '18 at 13:00

















Thanks, so as I need to check both folder (SE & ME) at the same time I need to do two check one for the SE folder and one for the ME folder ?

– flyer74
Nov 27 '18 at 21:02





Thanks, so as I need to check both folder (SE & ME) at the same time I need to do two check one for the SE folder and one for the ME folder ?

– flyer74
Nov 27 '18 at 21:02













@flyer74 With your current structure, that is correct. I don't know why there are two nodes (SE and ME) so it may simply be a matter of changing your structure to make it flatter (demormalizing) and include that as a child node instead of making it a parent node. So within the uid parent node you would have each child node include what you have now, .picture and .registration etc but also have a .se_or_me: "SE" or .se_or_me: "ME". I added an edit to my answer to demonstrate that structure.

– Jay
Nov 28 '18 at 18:31







@flyer74 With your current structure, that is correct. I don't know why there are two nodes (SE and ME) so it may simply be a matter of changing your structure to make it flatter (demormalizing) and include that as a child node instead of making it a parent node. So within the uid parent node you would have each child node include what you have now, .picture and .registration etc but also have a .se_or_me: "SE" or .se_or_me: "ME". I added an edit to my answer to demonstrate that structure.

– Jay
Nov 28 '18 at 18:31















Thank for your answer, I'll try it but I also have a TableView in an other View witch is divided by 2 sections one for SE and one for ME I need to modify this section also ..

– flyer74
Dec 2 '18 at 17:21





Thank for your answer, I'll try it but I also have a TableView in an other View witch is divided by 2 sections one for SE and one for ME I need to modify this section also ..

– flyer74
Dec 2 '18 at 17:21













@flyer74 If you opt to change your structure to include a .se_or_me child then it won't matter because the child nodes contain SE or ME so you would know which it belongs to or can filter by that child node.

– Jay
Dec 2 '18 at 19:51





@flyer74 If you opt to change your structure to include a .se_or_me child then it won't matter because the child nodes contain SE or ME so you would know which it belongs to or can filter by that child node.

– Jay
Dec 2 '18 at 19:51




1




1





@flyer74 Awesome! I am glad it helped. Be sure to accept the answer so it can help others as well!

– Jay
Dec 4 '18 at 13:00





@flyer74 Awesome! I am glad it helped. Be sure to accept the answer so it can help others as well!

– Jay
Dec 4 '18 at 13:00




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53504884%2fhow-to-search-a-value-in-firebase-ios%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

Calculate evaluation metrics using cross_val_predict sklearn

Insert data from modal to MySQL (multiple modal on website)