java操作mongodb的更新插入操作

摘要: Query q = new Query(); q.addCriteria(Criteria.where("wxId").is(wxId).and("muserId").i(muserId)); Date now = org.apache.commons.lang.time.DateUtils.addHours(new Date(), 8); Update update = new Update(... 阅读全文
posted @ 2013-12-24 18:32 万里独行侠 阅读(1302) 评论(0) 推荐(0)

mongodb里的group语句

摘要: data = [{uid: 1 , event: 'a' , time: 1} , {uid: 1 , event: 'b' , time: 2} , {uid: 2 , event: 'c' , time: 2} , {uid: 3 , event: 'd' , time: 4} ] { {uid: 1} : [{uid: 1 ... 阅读全文
posted @ 2013-08-27 17:01 万里独行侠 阅读(536) 评论(0) 推荐(0)

MongoDB命令

摘要: db.AddUser(username,password) 添加用户 db.auth(usrename,password) 设置数据库连接验证 db.cloneDataBase(fromhost) 从目标服务器克隆一个数据库 db.commandHelp(name) returns the help for the command db.copyDataba... 阅读全文
posted @ 2013-07-19 22:09 万里独行侠 阅读(241) 评论(0) 推荐(0)

MongoDB

摘要: MongoDB语法 MySql语法 db.test.find({'name':'foobar'}) select * from test where name='foobar' db.test.find() select * from test db.test.find({'ID':10})... 阅读全文
posted @ 2013-07-19 22:05 万里独行侠 阅读(171) 评论(0) 推荐(0)

js去字符串空格

摘要: js中没有trim()这个函数,因此要自己定义一个字符串去空格的函数 1.基于正则的trim()函数 //去左右空格; function trim(s){ return rtrim(ltrim(s)); } //去左空格; function ltrim(s){ return s.replace( /^\s*/,... 阅读全文
posted @ 2013-05-24 11:04 万里独行侠 阅读(312) 评论(0) 推荐(0)

java获取项目路径

摘要: String path = request.getContextPath(); String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/"; 打印出: 阅读全文
posted @ 2013-05-24 10:53 万里独行侠 阅读(189) 评论(0) 推荐(1)