【MongoDB】The Regex Expression query of MongoDB,mongodbregex

來源:互聯網
上載者:User

【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)。這樣會導致資料庫直接關閉,上面降到的步驟都將被忽略,這會使資料檔案損毀。
 

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.