北在北方

太白枝头看,花开不计年,杯中浮日月,楼外是青天。

导航

随笔分类 -  MongoDB

摘要:1、一个文档如下db.posts.find(){ "_id" : ObjectId("5388162dfc164ee1f39be37f"), "title" : "Java Example", "content" : "This is a example for Java!", ... 阅读全文

posted @ 2014-05-30 13:58 CN.programmer.Luxh 阅读(458) 评论(0) 推荐(0)

摘要:1、添加超级管理员用户 1)切换到admin数据库>use admin 2)添加管理员用户 >db.addUser("admin","admin") 添加了一个叫admin的用户,密码是admin。拥有对任意数据库的所有权限 3)查看已添加的用户>db.system.users.find(){ "_id" : ObjectId("528c24eb30c8aafadfc15f60"), "user" : "admin", "readOnly" 阅读全文

posted @ 2013-11-20 11:23 CN.programmer.Luxh 阅读(1068) 评论(0) 推荐(0)

摘要:1、查询集合中的所有记录db.users.find(){ "_id" : ObjectId("528b1173613e3289197a6486"), "name" : "lihuai", "age" : 35, "status" : "A", "groups" : [ "news", "sports" ] }{ "_id" : ObjectId("528b17ffef 阅读全文

posted @ 2013-11-19 16:45 CN.programmer.Luxh 阅读(547) 评论(0) 推荐(0)

摘要:MongoDB以文档的形式存储数据,文档是类似于JSON键值对结构的BSON格式。 许多有共性的文档就组成一个集合。 集合、文档分别对应关系型数据库的表和行记录。 进入数据库:[mongodb@localhost bin]$ pwd/usr/local/mongodb-linux-x86_64-2.4.8/bin[mongodb@localhost bin]$ ./mongo 默认是进入到test数据库:MongoDB shell version: 2.4.8connecting to: test> ... 阅读全文

posted @ 2013-11-19 15:27 CN.programmer.Luxh 阅读(339) 评论(0) 推荐(0)

摘要:1、下载mongodb-linux-x86_64-2.4.8.tgz http://www.mongodb.org/downloads2、添加相应的组和用户[root@localhost local]# groupadd mongodb[root@localhost local]# useradd mongodb -g mongodb3、解压[root@localhost local]# tar -zxvf mongodb-linux-x86_64-2.4.8.tgz4、改变mongodb文件所属组和用户[root@localhost local]# chown -R mongodb:mon. 阅读全文

posted @ 2013-11-19 11:46 CN.programmer.Luxh 阅读(287) 评论(0) 推荐(0)

摘要:1、简单的配置<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mongo="http://www.springframework.org/schema/data/mongo" xsi:schemaLocation=& 阅读全文

posted @ 2013-06-18 15:10 CN.programmer.Luxh 阅读(1309) 评论(0) 推荐(0)