So I tried to create a page to add new friends in my IOS swift app. So, I first tried where "id" is not in AllMyFriendsIds.
db.collection("users").whereField("id",notIn: MyFriends).limit(to: limit).getDocuments(completion: { [self](snap, err) in
But with more than ten friends the program crashed. Then I tried to do where "friends" array-not-content userId but this method doesn't exist. Here is an example of the user's docs.
Here is the code that does not work so how to get all users that are not friend with us so where friends does not contain userId or where the docId or Id is not in an array(more than 10)
db.collection("users")
.whereField("friends",notIn: [UserDefaults().string(forKey: "userId")!])
.limit(to: limit)
.getDocuments(completion: {
My goal is to get users that are not my friends with the most efficient technique. Because I know how to do it by separating into groups of 10 but this technique is not efficient with reading and writing and cost a lot.