in our node js project we have chained . we have a function
const resultsCallback= function(){
/* some other code
*/
const result=mongoosemodel.find().sort().limit(5) ;
}
function fetchBycriteria(input1,input2){
service.getRequiredCriteriaItems(input1,input2,resultsCallback)
}
在开玩笑的情况下,我们使用了模仿对象来模仿该机制
但是我们只能模拟find()而不是链式排序或限制。
如何复制模仿猫鼬模型的行为,这种行为在其他方法中用于排序和限制