I hereby claim:
- I am rckrueger on github.
- I am rckrueger (https://keybase.io/rckrueger) on keybase.
- I have a public key ASDNem3ratEE5QDafy0940lf3DhpUktBjv85zl5u_0Idygo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
exports = async function(currentUserId, friendUserId) { | |
const mongodb = context.services.get("mongodb-atlas"); | |
const users = mongodb.db("CustomUserDB").collection("CustomUserData"); | |
let user = await users.findOne({userId: currentUserId}); | |
let friendUser = await users.findOne({userId: friendUserId}); | |
var chatPartition = currentUserId + "_" + friendUserId; | |
if (currentUserId > friendUserId) { | |
chatPartition = friendUserId + "_" + currentUserId; |
{ | |
"$or": [ | |
{ | |
"%%user.id": "%%partition" | |
}, | |
{ | |
"%%user.custom_data.chatPartitions": "%%partition" | |
} | |
] | |
} |
{ | |
"$or": [ | |
{ | |
"%%user.id": "%%partition" | |
}, | |
{ | |
"%%partition": "shared" | |
}, | |
{ | |
"%%user.custom_data.chatPartitions": "%%partition" |
Realm.asyncOpen(configuration: user.configuration(partitionValue: uid), | |
callback: { result in | |
switch result { | |
case .success(let realm): | |
self.userRealm = realm | |
case .failure(let error): | |
fatalError("Failed to open realm: \(error)") | |
} | |
}) |
import Foundation | |
import RealmSwift | |
class UserData: Object { | |
@objc dynamic var _id = ObjectId.generate() | |
@objc dynamic var _partition = "" | |
@objc dynamic var uid = "" | |
@objc dynamic var name = "" | |
override static func primaryKey() -> String? { | |
return "_id" |