$in 操作符

  The $in operator selects the documents where the value of a field equals any value in the specified array.

  $in 选择包含指定值之一的 doc。

  

  If the field holds an array, then the $in operator selects the documents whose field holds an array that contains at least one element that matches a value in the specified array

Use the $in Operator with a Regular Expression

The $in operator can specify matching values using regular expressions of the form /pattern/. Youcannot use $regex operator expressions inside an $in.

Consider the following example:

db.inventory.find( { tags: { $in: [ /^be/, /^st/ ] } } )

This query selects all documents in the inventory collection where the tags field holds an array that contains at least one element that starts with either be or st.

参考:https://docs.mongodb.org/manual/reference/operator/query/in/#op._S_in

随机推荐

  1. hdu3572

    题解: 网络流 判断是否为漫流 代码: #include <cstdio> #include <cstring> #include <algorithm> #inc ...

  2. 在JavaScript中进行文件处理,第五部分:Blobs

    译注:原文是<JavaScript高级程序设计>的作者Nicholas Zakas写的,本翻译纯属为自己学习而做,仅供参考.原文链接:这里 到目前为止,这个系列的帖子集中在和这些文件交互- ...

  3. OMAP4之DSP核(Tesla)软件开发学习(三)使能DSP核

    目标: 1.编译或直接获取DSP映像tesla-dsp.bin. 2.boot并使能DSP核(这个可以看启动打印或者进入/d/remoteproc/omap-rproc.0/参看dsp调试信息).   ...

  4. Alpha阶段敏捷冲刺---Day1

    一.Daily Scrum Meeting照片 二.今天冲刺情况反馈 1.昨天已完成的工作    昨天我们组全体成员在五社区五号楼719召开了紧急会议,在会议上我们梳理了编写这个程序的所有流程,并且根 ...

  5. win10中jdk1.8环境配置完,重启之后配置失效

    1.win10操作系统下重启电脑java环境变量失效 解决方式: 右击开始按钮,选择管理员方式的windows powershell,如下图: 在窗口中输入javac,一切正常,即使重启都不会有问题啦 ...

  6. LambdaMART简介——基于Ranklib源码(二 Regression Tree训练)

    上一节中介绍了 $ \lambda $ 的计算,lambdaMART就以计算的每个doc的 $\lambda$ 值作为label,训练Regression Tree,并在最后对叶子节点上的样本 $la ...

  7. create newline in Github Bio

    /********************************************************************************* * create newline ...

  8. 管道通信Pipe

    通信原理: 在内存中开辟管道空间,生成管道操作对象,多个进程使用“同一个”管道对象进程操作即可实现通信 函数方法: fd1,fd2 = Pipe(duplex = True) 功能: 创建管道 参数: ...

  9. swift3.0  代码创建经典界面的九宫图--优化篇

    在上一篇只是简单实现了九宫图效果,本章需要形成APP界面九宫图效果 override func viewDidLoad() { super.viewDidLoad() createnine() } / ...

  10. MyBatis_Study_001(入门)

    1.话不多说,直接搞起; (源码地址https://github.com/carryLess/mbtsstd-001) 2.去官网https://github.com/mybatis下载文件 下载完成 ...