【MongoDB】The high Query operation of MongoDB(一),mongodboperation
In the last blog, we talked about the basic operation of MongoDB, including insert, query, remove and update. Now in this blog, we will further hava a good understanding of querying operation.
At first, let's create 1000 recors for testing. As the following picture depicts.
Condition Expression
1. <, <=, >, <= is correspondent to ‘$lt’,'$Ite', '$gt' and '$gte'
2. $all
This operation is analogous to the $in operation. But the difference is that $all operation requires every elements in the array to be included in the return result.
3. $exists
$exists operation check whether one field exists.
提示waiting for connections .., 表示你的mongodb已经启动了。
不要关闭这个窗口,另启一个命令行,用mongo命令就可以进入数据库了。
如果服务器是作为前台进程运行在终端的,就直接按Ctrl-C。否则,就用kill这种命令发出信号。如果mongod的PID是10014,就可以用kill -2 10014(SIGINT)或者kill 10014(SIGTERM)。
当mongod收到SIGINT或者SIGTERM时,会稳妥退出。也就是说会等到当前运行的操作或文件预分配完成(需要一些时间),关闭所有打开的连接,将缓存的数据刷新到磁盘,最后停止。 千万不要向运行中的MongoDB发送SIGKILL(kill -9)。这样会导致数据库直接关闭,上面降到的步骤都将被忽略,这会使数据文件损毁。