Hey
I have the following logged record content and followed by an error in my developer console.
{ _id: 'fff55747-f004-42bc-8a41-3981a4453cb1', title: 'Trouble editing my site, can anyone help?', link: 'https://www.wix.com/code/home/forum/community-discussion/trouble-editing-my-site-can-anyone-help', comments: 0, likes: 0, views: 1, created: '7 minutes ago', recent: '7 minutes ago', author: 'xuda360 ', forum: 'Community Discussions', _createdDate: 2018-11-18T15:47:56.635Z, _updatedDate: 2018-11-18T15:47:56.635Z }
Hook afterQuery for collection WixShowForumContent result ignored! Expected hook result to resolve to an object with an '_id' property, but got [Undefined]
But as I see there is a _id in the content I get when console.log(item) and then I execute the below code and that don’t work as expected.
afterQuery function
export function WixShowForumContent_afterQuery(item, context) {
console.log(item);
deleteSpam(item);
}
And the hook calls on deleteSpam sending in the item.
export function deleteSpam(item) {
if (item.title.toLowerCase().includes("http://") || item.title.toLowerCase().includes("https://") || item.title.toLowerCase().includes("free shipping") || item.title.toLowerCase().includes("buy") || item.title.toLowerCase().includes("wa-") || item.title.toLowerCase().includes("keto")) {
wixData.remove("WixShowForumContent", item._id).then((removed) => {
console.log(removed);
})
}
}
And that does not work. Is it some limitations in the afterQuery hook?