欢迎投稿

今日深度:

【MongoDB】The high query operation of MongoDB(三),m

【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插入数据是按照什排序的,为何插入前三条按顺序,第四条就不是了

是按文件空间存储顺序存储
 

www.htsjk.Com true http://www.htsjk.com/shujukunews/3387.html NewsArticle 【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:...
评论暂时关闭