Hello,
(node:11557) UnhandledPromiseRejectionWarning: RangeError: Maximum call stack size exceeded
at Array.forEach (<anonymous>)
at Object.EJSON.clone (packages/ejson/ejson.js:594:18)
at packages/ejson/ejson.js:595:22
at Array.forEach (<anonymous>)
at Object.EJSON.clone (packages/ejson/ejson.js:594:18)
at packages/ejson/ejson.js:595:22
at Array.forEach (<anonymous>)
at Object.EJSON.clone (packages/ejson/ejson.js:594:18)
at packages/ejson/ejson.js:595:22
at Array.forEach (<anonymous>)
(node:11557) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 8)
i have this error when i’m debugging i see that it was from this code lines
PS: if i comment the find i don’t see the error
try {
console.log("useruseruser1", user);
var searchOptions = {};
if (!user.role || user.role == "" || user.role == "all") {
searchOptions["roles.app"] = {
$ne: "super-admin"
}
} else {
searchOptions["roles.app"] = user.role
}
if (user.keyword && user.keyword != "") {
searchOptions.$or = [{
"profile.firstName": {
$regex: user.keyword,
$options: 'i'
}
},
{
"username": {
$regex: user.keyword,
$options: 'i'
}
},
{
"profile.lastName": {
$regex: user.keyword,
$options: 'i'
}
},
{
"profile.bio": {
$regex: user.keyword,
$options: 'i'
}
},
{
"emails.address": {
$regex: user.keyword,
$options: 'i'
}
},
{
"profile.id": {
$regex: user.keyword,
$options: 'i'
}
}
];
}
searchOptions["profile.removed"] = false
console.log('searchOptionssearchOptions', searchOptions);
return Meteor.users.find(searchOptions, {
fields: {
'username': 1,
'emails': 1,
'profile': 1,
'roles': 1
}, // Ending Row
sort: {
"profile.createdAt": -1 //Sort by Date Added DESC
}
})
} catch (error) {
console.log("GetAllUsers Error", error);
if (error.reason) {
throw new Meteor.Error(203, error.reason);
} else {
throw new Meteor.Error(203, error);
}
}