
Create:
let babyResult: Baby = try await database.createDocument(
databaseId: R.Database.babyBottleDbId,
collectionId: R.Database.babyCollectionId,
documentId: babyId,
data: data,
permissions: [
Permission.read(Role.team(babyId)),
Permission.write(Role.team(babyId)),
Permission.delete(Role.team(babyId)),
Permission.update(Role.team(babyId))
], nestedType: Baby.self).data

Get:
func fetchBabies() async throws -> [Baby] {
try await database.listDocuments(
databaseId: Constants.Database.babyBottleDbId,
collectionId: Constants.Database.babyCollectionId,
nestedType: Baby.self
).documents.map { $0.data }
}

I can see the document and the permission are ok in the console

And my user has membership of the team of course

is it normal that the document ID is the same as the team ID ? (babyId)

Yeah creating a baby also create a team with the same id (easier for me)

(this allow users to manage the same baby if they are member of the same team)

func fetchBabies() async throws -> [Baby] {
let response = await database.listDocuments(
databaseId: Constants.Database.babyBottleDbId,
collectionId: Constants.Database.babyCollectionId,
nestedType: Baby.self
)
console.log(response)
}
Can you try this instead ? I think that the problem might be coming from the .map

Sorry, I proxy the request and I have printed the network response and Document is empty but total is 1 (see my first message)

Oh okk weird 🤔

maybe a bad migration? I can re-run the database migration just to see

maybe yeah, before that can you try to add user permission for this document ? see if it change anything ?

(in addition as the team permission)

yeah I've tried to add permission to my specific user, it didn't changed anything

well I have no idea sorry, maybe try to redo a migration

no effects 😦

Looks like Document Security is ignored only collection permission works

Update: adding a query limit fix the issue:

solution:
func fetchBabies() async throws -> [Baby] {
try await database.listDocuments(
databaseId: Constants.Database.babyBottleDbId,
collectionId: Constants.Database.babyCollectionId,
queries: [
Query.limit(100) // otherwise document are empty!
],
nestedType: Baby.self
).documents.map { $0.data }
}

That's super weird

Ok what is super weird is that I have another listDocument query with a limit, and if I don't put the same query limit value for the both request, it doesn't works

I think there is a really issue somewhere

Ya, there's some funky behavior with permissions at the moment. We're working through them ASAP

Thanks @Steven I’m using the query limite as workaround for now

We just released 1.3.2! See https://discord.com/channels/564160730845151244/636818236310159360/1101246221089263617. Thanks for your patience!
Recommended threads
- Realtime Disconnects and Error: INVALID_...
Hi Support, we are still experiencing the issue and we are a subscriber on your platform under the account of charlesbcalague@gmail.com I just want to ask here...
- Collection Permission issue
I am facing issue in my Pro account. "Add" button is disabled while adding permission in DB collection settings.
- SSO google apple not working anymore
We use Apple and Google sso in our react native app. Everything worked fine until we noticed today that we see general argument error. We did not change anythi...
