can’t write user custom data from client
could do so when my “User” data model had primary key as a UUID string
now I have ObjectId and following the example in documentation
func insertOne() {
let user = app.currentUser!
let client = user.mongoClient("mongodb-atlas")
let database = client.database(named: "")
let collection = database.collection(withName: "User")
// Insert the custom user data object
collection.insertOne([
"_id": AnyBSON.objectId(ObjectId)
throws an error
Cannot convert value of type 'ObjectId.Type' to expected argument type 'ObjectId'
while
"_id": AnyBSON(user.id)
used to work fine when _id
was uuid string
no wonder…
Andrew Morgan uses it in his Chat App !!!
but why???