I tried this code but getting the same result,
const resultPromises = i.map(async (element, index) => {
return await new Promise(async (resolve) => await Meteor.call("fetchData", limit, index * limit, false, (error, result) => resolve(result)));
})
Here is my “fetchData” method code:
'fetchData': function fetchData(limit, skip, checkCount){
check([limit, skip], [Number]);
check(checkCount,Boolean);
const user = Meteor.user();
if (!user) throw new Meteor.Error('not-authorized');
let clientId = user.profile.clientId;
let locations = Locations.find(
{ clientId },
{
sort: {
locationName: 1,
},
fields: { updatedAt: 0, owner: 0 },
}
);
if(checkCount) return locations.count();
return locations.fetch();
}