MongoDB高级查询 互动版

在线工具推荐: Three.js AI纹理开发包 - YOLO合成数据生成器 - GLTF/GLB在线编辑 - 3D模型格式在线转换 - 可编程3D场景编辑器

javascript查询和$where查询

查询a 大于3 的数据,下面的查询方法殊途同归

>db.c1.find( { a : { $gt: 3 } } );

>db.c1.find( { $where: "this.a > 3" } );

>db.c1.find("this.a > 3");

>f = function() { return this.a > 3; } db.c1.find(f);

查询users文档中年龄大于20的记录

f = function() { return this.age > 20; }; db.users.find(f);