I am trying to filter out a id from Realm object like this:
let itemsInCart = realm.objects("Cart").filtered("id = " + itemId);
My Cart schema is as follows:
export const CART_SCHEMA = "Cart";
export const CartSchema = {
name: CART_SCHEMA,
primaryKey: "id",
properties: {
id: "string",
quantity: "int",
productName: "string",
productImage: "string"
}
};
I want to check whether the id exists or not in my Cart object but whenever I try to filter out the id it gives the following error:
Try this to filter object by ID in Realm
let itemsInCart = realm.objects("Cart").filtered("id == $0", itemId);
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments