【MongoDB】The Regex Expression query of MongoDB

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.

时间: 2024-10-25 04:37:18

【MongoDB】The Regex Expression query of MongoDB的相关文章

【总结】java regex 正则表达式 提取数字和去除数字,过滤数字,提取价格

转: [总结]java regex 正则表达式 提取数字和去除数字,过滤数字,提取价格 @Test public void test33() { String phoneString = "哈哈,13888889999"; // 提取数字 // 1 Pattern pattern = Pattern.compile("[^0-9]"); Matcher matcher = pattern.matcher(phoneString); String all = matc

【数据库】Mean web开发 02-Windows下Mongodb安装配置及常用客户端管理工具

简介 Mean是JavaScript的全栈开发框架.更多介绍 用MongoDB实现持久数据的存储是Mean Web全栈开发中的一部分. MongoDB是一个介于关系数据库和非关系数据库之间的产品,是非关系数据库当中功能最丰富,最像关系数据库的.它的特点是高性能.易部署.易使用,存储数据非常方便. MongoDB的学习资料可参考: MongoDB中文社区 MongoDB 下载及安装 下载地址:https://www.mongodb.com/download-center#community 根据你

【MonogoDB】The high update operation of MongoDB

In the last four blog, we talked about the high query operation of mongodb. Now in this blog let's know about the high update operation about monodb. 1. Save as for save(), whose function is to update the existing record and to create the new record.

【安装MongoDB】CentOS7 下安装NodeJs+Express+MongoDB+Redis

MongoDB,V3.2版本,官网说的很详细,见链接:https://docs.mongodb.com/manual/tutorial/install-mongodb-on-red-hat/ 1.创建配置文件, vi /etc/yum.repos.d/mongodb-org-2.6.repo [mongodb-org-3.2] name=MongoDB Repository baseurl=https://repo.mongodb.org/yum/redhat/$releasever/mongo

【leetcode】10.Regular Expression Matching

题目描述: Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or more of the preceding element. 解题思路: 这道题如果只考虑“.”的话其实很好完成,所以解题的关键在于处理“*”的情况.以为“*”与前一个字母有关,所以应该整体考虑ch*……的情况.ch*可以匹配0-n个s的字符串

【MongoDB】在windows平台下搭建mongodb的分片集群(二)

在上一片博客中我们讲了Mongodb数据库中分片集群的主要原理.在本篇博客中我们主要讲描述分片集群的搭建过程.配置分片集群主要有两个步骤,第一启动所有需要的mongod和mongos进程.第二步就是启动一个mongos与集群通信.下面我们一步步来描述集群的搭建过程. 图1-1  MongoDB分片集群中的组件 图 1-2 由实例分片集群构成的进程全貌 备注:以上两者图片均引自于Kyle Banker著 丁雪丰译<MongoDB 实战> 2.1 创建分片目录 备注:此处于创建复制集类似,详细请查

【MongoDB】The description of procedure in MongoDB

In this blog the procedure of mongodb will be described in details. It is known that mongodb has provided a series of efficient solution to some different questions, such as high performance, changeable type and so on. Compared with the mysql databas

【MongoDB】Configure a Windows Service for MongoDB

In this blog, I will mainly attach great importantance to how to create a windows service for mongodb. The method described in the next is referred from the official website of mongodb. http://docs.mongodb.org/manual/tutorial/install-mongodb-on-windo

【MongoDB】在window系统下搭建MongoDB的分片系统(一)

这篇主要讲述分片集群的主要原理 坦白说,刚看到这个分片系统(Sharding)有点蒙,感觉有点太高大上了.看美国作家Kyle Banker<Mongodb in action>没有明白.又查询资料,首先对与分片的做个说明.从其他书本上看的,说分片这是一种将海量数据水平扩展的数据库集群系统,数据分表存储在sharding的各个节点上,使用者通过简单的配置就可以很方便地够将一个分布式MongoDB集群. 一.角色说明 要构建一个MongoDB分片集群,需要三个角色: shard server  即