Hello,
I’m new posting in this forum. I hope you can help me, guys. I have this bug about a query. It says that a comparison cannot be done with objectId type, but this schema called people
with these attributes slug
, platforms
, key
, value
are not objectId type, they are all string type.
I’m using
"react-native": "0.70.6",
"realm": "^11.3.1",
This is the function
const getCollaboratorsByPlatform = (platformName, selectedLocationId) => {
return getPeoples()
.filtered(
`roles.slug LIKE "Collaborator"
AND roles.platforms LIKE $0
AND extras.key LIKE "collaborator_registration_data_location_id"
AND extras.values.value LIKE $1`,
platformName,
selectedLocationId
)
.sorted('created_at', true);
};
And this is the schema definition
{
"properties": {
"_id": {
"bsonType": "objectId"
},
"_partitionKey": {
"bsonType": "string"
},
"active": {
"bsonType": "bool"
},
"birthdate": {
"bsonType": "date"
},
"country_id": {
"bsonType": "string"
},
"created_at": {
"bsonType": "date"
},
"created_by": {
"bsonType": "objectId"
},
"deleted_at": {
"bsonType": "date"
},
"emails": {
"bsonType": "array",
"items": {
"bsonType": "object",
"properties": {
"_id": {
"bsonType": "objectId"
},
"type": {
"bsonType": "string"
},
"value": {
"bsonType": "string"
},
"verified": {
"bsonType": "bool"
}
}
}
},
"externals": {
"bsonType": "array",
"items": {
"bsonType": "object",
"properties": {
"_id": {
"bsonType": "objectId"
},
"platform": {
"bsonType": "string"
},
"platform_id": {
"bsonType": "string"
},
"registered_at": {
"bsonType": "date"
}
}
}
},
"extras": {
"bsonType": "array",
"items": {
"bsonType": "object",
"properties": {
"key": {
"bsonType": "string"
},
"updated_at": {
"bsonType": "date"
},
"values": {
"bsonType": "array",
"items": {
"bsonType": "object",
"properties": {
"coll_name": {
"bsonType": "string"
},
"value": {
"bsonType": "string"
},
"value_id": {
"bsonType": "objectId"
},
"value_type": {
"bsonType": "string"
}
}
}
}
}
}
},
"first_name": {
"bsonType": "string"
},
"full_name": {
"bsonType": "string"
},
"ids": {
"bsonType": "array",
"items": {
"bsonType": "object",
"properties": {
"_id": {
"bsonType": "objectId"
},
"country_id": {
"bsonType": "objectId"
},
"expiration_at": {
"bsonType": "date"
},
"issued_at": {
"bsonType": "date"
},
"type": {
"bsonType": "string"
},
"url": {
"bsonType": "string"
},
"value": {
"bsonType": "string"
}
}
}
},
"last_name": {
"bsonType": "string"
},
"middle_name": {
"bsonType": "string"
},
"nationality_id": {
"bsonType": "objectId"
},
"person_type": {
"bsonType": "string"
},
"phones": {
"bsonType": "array",
"items": {
"bsonType": "object",
"properties": {
"_id": {
"bsonType": "objectId"
},
"calling_code": {
"bsonType": "string"
},
"phone_number": {
"bsonType": "string"
},
"type": {
"bsonType": "string"
},
"verified": {
"bsonType": "bool"
}
}
}
},
"relationships": {
"bsonType": "array",
"items": {
"bsonType": "object",
"properties": {
"person_id": {
"bsonType": "objectId"
},
"type": {
"bsonType": "string"
}
}
}
},
"roles": {
"bsonType": "array",
"items": {
"bsonType": "object",
"properties": {
"platforms": {
"bsonType": "array",
"items": {
"bsonType": "string"
}
},
"slug": {
"bsonType": "string"
}
}
}
},
"second_last_name": {
"bsonType": "string"
},
"status": {
"bsonType": "string"
},
"updated_at": {
"bsonType": "date"
}
},
"required": [
"_id",
"first_name",
"active",
"created_by",
"created_at",
"_partitionKey"
],
"title": "people"
}
I’ll be thankful if anyone can help me with this issue.