【MongoDB】The high query operation of MongoDB(三),mongodboperation
1, Sort
Needless to say, mongodb also support to sort data. THe positive one means sorting by asc order and negetive means by desc.
2. Group
The grammar of group:
Description Of Argument:
key: The field need to group
cond: query condition
Initial: initialize the counter of group
Redue: generally statistic operation
Finalize: further operation after group, for exampe calcuate the average.
3.
3. Distinct
it's the same as the distinct in the relational database.
4. page
The mongodb supports to use skip and limit to query by page.
5. Cursors and Cursor Methods
6. $query/$orderby/$explain
【MongoDB】怎停止MongoDB伺服器
如果伺服器是作為前台進程運行在終端的,就直接按Ctrl-C。否則,就用kill這種命令發出訊號。如果mongod的PID是10014,就可以用kill -2 10014(SIGINT)或者kill 10014(SIGTERM)。
當mongod收到SIGINT或者SIGTERM時,會穩妥退出。也就是說會等到當前啟動並執行操作或檔案預分配完成(需要一些時間),關閉所有開啟的串連,將緩衝的資料重新整理到磁碟,最後停止。 千萬不要向運行中的MongoDB發送SIGKILL(kill -9)。這樣會導致資料庫直接關閉,上面降到的步驟都將被忽略,這會使資料檔案損毀。
mongodb插入資料是按照什排序的,為何插入前三條按順序,第四條就不是了
是按檔案空間儲存順序儲存