You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a Firebase Database structure as follows:
users(collection)/user_id(documents)/pets(collection)/pets_id(document)
Trying to get query working for collecting all pets documents of a specific user. I got it working on the firebase query builder
and I can get query working for the first layer of collections users:
var users_collection_path = "users"
var pets_query : FirestoreQuery = FirestoreQuery.new()
pets_query.from(users_collection_path)
pets_query.limit(100)
var pets_data = await Firebase.Firestore.query(pets_query)
print(pets_data)
but I do not get any subcollections even thou all_descendants is true(by default)
I also tried building query for subcollections directly as in query builder, but get an error
var pets_subcollection_path = USER_COLLECTION_ID + "/" + auth.localid + "/" + PET_COLLECTION_ID
var pets_query : FirestoreQuery = FirestoreQuery.new()
pets_query.from(pets_subcollection_path)
pets_query.limit(100)
var pets_data = await Firebase.Firestore.query(pets_query)
print(pets_data)
but get "Nil" error
Am I doing something wrong here? Any help would be greatly appreciated! If this doesn't work I could restructure my database with not having any subcollections ever, but I think there should be a way to get this working
Doesn't seem like you can change the automatic index settings ones if thats what you mean.
Tried to create a wildcard field path one I found mentioned on stack overflow, but still only gives me top level documents and not subcollections
It looks like you might have it setup right, although it's hard to tell. I was mistaken based on not having a pic of my own up when I was speaking earlier.
Well, the only thing I can tell is it works for others when we do this, myself included, but not you. My only real recommendation is to figure out either how to run the query with a Cloud Function, or restructure your database so you're not going against sub collections like that.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Hello,
I have a Firebase Database structure as follows:
users(collection)/user_id(documents)/pets(collection)/pets_id(document)
Trying to get query working for collecting all pets documents of a specific user. I got it working on the firebase query builder

and I can get query working for the first layer of collections users:
but I do not get any subcollections even thou
all_descendantsis true(by default)I also tried building query for subcollections directly as in query builder, but get an error
but get "Nil" error

Am I doing something wrong here? Any help would be greatly appreciated! If this doesn't work I could restructure my database with not having any subcollections ever, but I think there should be a way to get this working
All reactions