Can delete an object from realm DB by id?


#1

I have a schema as the following:
export const logs = {
name: “Logs”,
primaryKey: “id”,
properties: {
id: “string”,
userId: “string”,
log: “string”,
},
};

and there are many records in the table, and I want to delete a record by id and not get the object to delete it.
Can do it?


#2

Your best option is to combine objectForPrimaryKey and delete. There is no method to delete an object by specifying the primary key.