I am using the code from the docs to set my customUserData:
func updateUserCustomData() {
app.login(credentials: Credentials.anonymous) { (result) in
switch result {
case .failure(let error):
print("Failed to log in: \(error.localizedDescription)")
case .success(let user):
// Access the custom user document remotely to update it.
// need to make these constants
let client = user.mongoClient("mongodb-atlas")
let database = client.database(named: "AltoProDev0")
let collection = database.collection(withName: "User")
collection.updateOneDocument(
filter: ["userId": AnyBSON(user.id)],
but the user.id is wrong! I have no idea where it is getting the id as I checked the App User and my User table and that ids are the same but different than the user.id referenced in the code… what is going on?
Thank you