class Message extends Realm.Object {}
Message.schema = {
name: "Message",
properties: {
id: "string",
messageId: "string",
text: "string",
time: "string",
type: "string"
}
};
getMessage(id) {
const messageId = id;
return realm.objects("Message").filtered("id=" + messageId);
}
if l use getMessage();
it will throw " Predicate expressions must compare a keypath and another keypath or a constant value" Exception
@cl1069573062 Any indication of what messageID is?
You are missing quotes around messageId i.e., filtered('id = "' + messageID + '"');
That'd probably be better written as filtered('id = $0', messageID) to avoid problems if the substituted value happens to contain double quote characters.
@bdash thanks that's work
Cool. I'll close the issue.
Most helpful comment
@cl1069573062 Any indication of what
messageIDis?You are missing quotes around
messageIdi.e.,filtered('id = "' + messageID + '"');