I am using react navigation and want to update an entry in a subscreen. The problem is that I can’t pass the actual “project” object because the key is BSON and can’t be serialized. So I thought I would search by primarykey but not sure what to search for. The boilerplate code defines primarykey in schema and apparently sets it to the _id. The question is what is the primaryKey really set to? I would like to be able to have it be some value that can be serialized or even better the HexString of the _id so I can determine the primaryKey from the _id. Thoughts?
class Project extends Realm.Object {
static generate(title, description, address, lat, lon) {
return {
_id: new Realm.BSON.ObjectId(),
title ,
description,
address,
lat,
lon,
createdAt: new Date(),
}
}
static schema = {
name: 'Project',
primaryKey: '_id',
properties: {
_id: 'objectId',
title: 'string',
description: 'string',
lat: 'float',
lon: 'float',
createdAt: 'date'
},
};
}