I have this code in my realm functions but it keeps returning an empty array even tho my collection is not empty.
this is my code.
exports = async function(salonId, imageLink) {
const mongodb = context.services.get("mongodb-atlas");
const customerWebSettings = mongodb.db("glamiris").collection("customerWebSettings");
const data = await customerWebSettings.find({})
if (data==null) {
return {status:false, message:'salon not found'}
}
return {'data':data}
}
roles and permission have also been set for the collections too.
{
"database": "glamiris",
"collection": "customerWebSettings",
"roles": [
{
"name": "admin",
"apply_when": {
"%%user.custom_data.isGlobalAdmin": true
},
"document_filters": {
"read": true,
"write": true
},
"insert": true,
"delete": true,
"search": true,
"read": true,
"write": true
},
{
"name": "user",
"apply_when": {},
"document_filters": {
"read": {
"owner_id": "%%user.id"
},
"write": {
"owner_id": "%%user.id"
}
},
"insert": true,
"delete": true,
"search": true,
"read": true,
"write": true
}
]
}