search

Home  >  Q&A  >  body text

刚学mean,用monk连mongodb,find的第二个用来过滤键的参数为何无效

    var collection=db.get("foo");
    collection.find({},{"name":0},function(e,docs){
        //TODO
    });

无论直接在前台看还是用调试工具看,name这个键都没有被过滤掉,是因为monk和原生的方法有什么不同还是别的什么原因?

巴扎黑巴扎黑2764 days ago593

reply all(1)I'll reply

  • 伊谢尔伦

    伊谢尔伦2017-04-25 09:05:31

    Try the method given in the official usage example:

    collection.find({},'-name',function(e,docs){
            //TODO
    });
       

    In addition, monk is a tool that is rarely used by people, so why not use mongoose? The usage is basically similar, and it is developed by the same team. It has richer functions, more people use it, and better community support. I suggest you give it a try.

    reply
    0
  • Cancelreply