欢迎投稿

今日深度:

【MongoDB】The Regex Expression query of MongoDB,mongodbr

【MongoDB】The Regex Expression query of MongoDB,mongodbregex


In the past two blogs, the topic mainly focus on the high query operation of mongodb.In this blog, we simply study the regex expression in the mongdb.  MongoDB also support the regex query. For example


The expression is also able to combination with other expression.



Notes: /^a/; /^a.*/; /^a.*$/ have the same result, however the later two have less efficiency than the first one. Because the later will scan all the things, but the first only scan the first character. 

The item:

-i : ignore the upper or low case 

-m: the begin '^' and end'$' do work on every new line;

-x: ignore the blank character

-s:  since 1.9 version, adding it could make '.' reprent all the character. 

for example:

/a.*b/ does not matches "apple\nbanana" but /a.*b/s does. 





the expressions of 还是the expression of

根据它后边跟的中心词来确定。expression是可数名词。
 

【MongoDB】怎停止MongoDB服务器

如果服务器是作为前台进程运行在终端的,就直接按Ctrl-C。否则,就用kill这种命令发出信号。如果mongod的PID是10014,就可以用kill -2 10014(SIGINT)或者kill 10014(SIGTERM)。
当mongod收到SIGINT或者SIGTERM时,会稳妥退出。也就是说会等到当前运行的操作或文件预分配完成(需要一些时间),关闭所有打开的连接,将缓存的数据刷新到磁盘,最后停止。 千万不要向运行中的MongoDB发送SIGKILL(kill -9)。这样会导致数据库直接关闭,上面降到的步骤都将被忽略,这会使数据文件损毁。
 

www.htsjk.Com true http://www.htsjk.com/shujukunews/3421.html NewsArticle 【MongoDB】The Regex Expression query of MongoDB,mongodbregex In the past two blogs, the topic mainly focus on the high query operation of mongodb.In this blog, we simply study the regex expression in the mongdb. MongoDB also support th...
评论暂时关闭