javascript Mongo命令用于过滤引用计数
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了javascript Mongo命令用于过滤引用计数相关的知识,希望对你有一定的参考价值。
//users who unlocked before july: 7 more days (after official announcement is made)
[{"expire": 1566988355, "metadata": {"reply_remaining": 100}, "permission": "jobpool_reply"}, {"expire": 1566988355, "permission": "jobpool_instant_new_job_notify"}, {"expire": 1566988355, "permission": "jobpool_new_job_email"}, {"expire": 1566988355, "permission": "jobpool_job_record"}, {"expire": 1566988355, "permission": "jobpool_advance_filter"}, {"expire": 1566988355, "metadata": {"cancel": 1566384256, "premium_type": "plus"}, "permission": "premium_ac"}]
db.getCollection('referrals')
.find({
$where:function() {
if(this.admin_injected_count){
if(this.receiver_objects){
//both admin inject and receiver object exist
if(this.admin_injected_count + this.receiver_objects.length >= 1){
return true;
} else {
return false;
}
} else {
//only admin inject
if(this.admin_injected_count > 0){
return true;
} else {
return false;
}
}
} else{
if(this.receiver_objects){
//only receiver object
if(this.receiver_objects.length >= 1){
return true;
} else {
return false;
}
} else {
return false;
//both doesnt exist
}
}
},
date:{
"$lte":new Date("2019-07-01T00:00:00.000Z")
}
},
{
sender_id: 1
})
.toArray()
// unlocked in july or later: 1 month left
[{"expire": 1569062051, "metadata": {"reply_remaining": 100}, "permission": "jobpool_reply"}, {"expire": 1569062051, "permission": "jobpool_instant_new_job_notify"}, {"expire": 1569062051, "permission": "jobpool_new_job_email"}, {"expire": 1569062051, "permission": "jobpool_job_record"}, {"expire": 1569062051, "permission": "jobpool_advance_filter"}, {"expire": 1569062051, "metadata": {"cancel": 1566384256, "premium_type": "plus"}, "permission": "premium_ac"}]
db.getCollection('referrals')
.find({
$where:function() {
if(this.admin_injected_count){
if(this.receiver_objects){
//both admin inject and receiver object exist
if(this.admin_injected_count + this.receiver_objects.length >= 1){
return true;
} else {
return false;
}
} else {
//only admin inject
if(this.admin_injected_count > 0){
return true;
} else {
return false;
}
}
} else{
if(this.receiver_objects){
//only receiver object
if(this.receiver_objects.length >= 1){
return true;
} else {
return false;
}
} else {
return false;
//both doesnt exist
}
}
},
date:{
"$gt":new Date("2019-07-01T00:00:00.000Z")
}
},
{
sender_id: 1
})
.toArray()
// -if purchase plus plan jau will automatically add 7 more days to them
// -system needs to be able to auto lock 返job pool after the days expire
以上是关于javascript Mongo命令用于过滤引用计数的主要内容,如果未能解决你的问题,请参考以下文章