我想对每个用户进行限制,每天只发布5次内容。
{
_id: 5a3a67b102d9d926f8cd66b8
groupname: 'Testing',
member: [
{userid:123},
{userid:456},
{userid:789},
{userid:879}
]
}
实际上,我有一种方法,即
First create the column which may be named as entries_counter, after that every entry did successfully, we have to increment the counter till it 5. After 5 we will stop doing the entries. And every day at night or some time format we will update the entries_counter value to 0 through CronJob.
建议我一些最佳或预定义/预建的方法,这将有效地处理这些类型的情况。任何帮助都是赞赏的。
发布后,执行查询,计算用户在过去24小时内创建的帖子数。如果超过MAX_POSTS_ALLOWED,请不要允许。
在我看来,你不应该明确跟踪每天创建的帖子数量。或者您需要每天清除该列。