欢迎投稿

今日深度:

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

【MongoDB】The high query operation of MongoDB(二),mongodboperation


In the last blog, there are three query condition to be described. In the blog, we will continue to what we have leant in the last blog. 

1 $mod 

'$mod' operation is able to make us to do simple mod operation, but is no need to use where sentence. 

\

2. $ne, $in, $nin

‘$ne’ means not equal. '$in' is same as key word 'in' in relationship. $nin is opsitive to 'in'


3.$or and $nor 

durning the mutiple conditions, then result will be return that it only matches one condition among condition. 

as for $noe, which is in contrast with $no, let's learn it from the following the picture. 


4. $size

$size operation will query result whose size is equailvant to size of input.


5. $where 



6. $type

$type will find the data according the type of bson field. For example:

The following picture is the type of bson type. 



【MongoDB】怎停止MongoDB服务器

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

想MongoDB这类NoSql,是不是只可以存储文本信息而不可以存储二进制信息?

MongoDB是文档存储型数据库。它的存储是给予操作系统中的文件存储系统的。所以只要是文件系统可以存的,mongodb都可以存。

如果要保存一些二进制的大数据文件,可以用GridFS数据结构。
 

www.htsjk.Com true http://www.htsjk.com/shujukunews/3358.html NewsArticle 【MongoDB】The high query operation of MongoDB(二),mongodboperation In the last blog, there are three query condition to be described. In the blog, we will continue to what we have leant in the last blog. 1 $mod '$mod' operation is...
评论暂时关闭