mongo数据库的常见操作

连接mongodb数据库的命令查看对应数据库
mongo.exe
use shujukuming;
db.opportunity.findOne({"id":5});

db.opportunity.findOne();

db.facultype.drop();
db.institute.drop();
db.node.drop();

db.opportunity.drop();
db.program.drop();
db.user.drop();

db.userweb.drop();

"title_pic" : "./upload/product/logo/2016-01-09/thumb/1452323575_4478803
86.jpg"

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>d:

D:\>cd D:\developsoftware\MongoDB\bin

D:\developsoftware\MongoDB\bin>net start MongoDB
MongoDB 服务正在启动 .
MongoDB 服务已经启动成功。

D:\developsoftware\MongoDB\bin>mongo.exe
2016-01-09T11:12:44.498+0800 I CONTROL [main] Hotfix KB2731284 or later update
is not installed, will zero-out data files
MongoDB shell version: 3.2.0
connecting to: test
> use shujukuming;
switched to db shujukuming
> db.opportunity.findOne({"id":5});
{
"_id" : ObjectId("5645576c916891242b28318c"),
"id" : 5,
"institute_id" : 300,
"institute" : "University of Wisconsin–?Madison",
"tinstitute" : "威斯康星大学-麦迪逊",
"title" : "Visiting International Student Program",
"type" : 1,
"level" : 4,
"url" : "http://continuingstudies.wisc.edu/visp/index.html",
"introduce" : "Experience UW-Madison student life! The Visiting Interna
ional Student Program (VISP) offers you an opportunity to become an official UW
Madison student and to take regular university courses with our world-class fac
lty. ",
"benefit" : "1.you may join clubs, use libraries, computer and sports a
d facilities, and have full access to all student support services. <br>\n2.you
will leave UW-Madison with the knowledge you gained and an official transcript
f the work you completed on our campus. <br>\n3.Your academic work at UW-Madiso
may transfer toward your degree program at home or to a degree program in the
uture. <br>\n4.you’ll be invited to participate in and join activities sponsor
d by the Wisconsin Alumni Association (WAA) international network of over 400,0
0 students worldwide.<br>\n5.The Madison Experience :peaceful places to study a
d explore while experiencing the beauty of our city.",
"to_who" : "",
"apply_fee" : "",
"cost" : "$ 22,305 Fall or Spring (4 Months)<br>\n$46,353 Academic Year
(9 Months)<br>\n$ 5,614 4-Week Session (1 Month)<br>\n$11,178 8-Week Session (2
Months)",
"cost_url" : "http://continuingstudies.wisc.edu/visp/financial-requirem
nts.htm",
"attention" : "",
"apply_url" : "https://uwmadison.qualtrics.com/SE/?SID=SV_0HTPAaHgHK45d
o",
"deadline" : "Fall : May 1<br>\nSpring : September 1<br>\nSummer (Diff
rent sessions offered between May - August) : February 1",
"requirement" : "TOEFL: Minimum of 80 for Internet (iBT) and 550 for pa
er test or 213 (computer-based) <br>\nIELTS: Minimum of 6.5<br>\nGPA:3.0<br>\nS
anned copy of official college transcripts <br>\nScanned copy of passport infor
ation page<br>\nScanned copy of your financial support documents\n\n",
"term" : "Fall Semester (September - December)<br>\nSpring Semester (Ja
uary - May) <br>\nSummer (Different sessions offered between May - August)",
"apply_process_url" : "http://continuingstudies.wisc.edu/visp/applyvisp
htm"
}
> db.opportunity.findOne({"id":5});
{
"_id" : ObjectId("5645576c916891242b28318c"),
"id" : 5,
"institute_id" : 300,
"institute" : "University of Wisconsin–?Madison",
"tinstitute" : "威斯康星大学-麦迪逊",
"title" : "Visiting International Student Program",
"type" : 1,
"level" : 4,
"url" : "http://continuingstudies.wisc.edu/visp/index.html",
"introduce" : "Experience UW-Madison student life! The Visiting Interna
ional Student Program (VISP) offers you an opportunity to become an official UW
Madison student and to take regular university courses with our world-class fac
lty. ",
"benefit" : "1.you may join clubs, use libraries, computer and sports a
d facilities, and have full access to all student support services. <br>\n2.you
will leave UW-Madison with the knowledge you gained and an official transcript
f the work you completed on our campus. <br>\n3.Your academic work at UW-Madiso
may transfer toward your degree program at home or to a degree program in the
uture. <br>\n4.you’ll be invited to participate in and join activities sponsor
d by the Wisconsin Alumni Association (WAA) international network of over 400,0
0 students worldwide.<br>\n5.The Madison Experience :peaceful places to study a
d explore while experiencing the beauty of our city.",
"to_who" : "",
"apply_fee" : "",
"cost" : "$ 22,305 Fall or Spring (4 Months)<br>\n$46,353 Academic Year
(9 Months)<br>\n$ 5,614 4-Week Session (1 Month)<br>\n$11,178 8-Week Session (2
Months)",
"cost_url" : "http://continuingstudies.wisc.edu/visp/financial-requirem
nts.htm",
"attention" : "",
"apply_url" : "https://uwmadison.qualtrics.com/SE/?SID=SV_0HTPAaHgHK45d
o",
"deadline" : "Fall : May 1<br>\nSpring : September 1<br>\nSummer (Diff
rent sessions offered between May - August) : February 1",
"requirement" : "TOEFL: Minimum of 80 for Internet (iBT) and 550 for pa
er test or 213 (computer-based) <br>\nIELTS: Minimum of 6.5<br>\nGPA:3.0<br>\nS
anned copy of official college transcripts <br>\nScanned copy of passport infor
ation page<br>\nScanned copy of your financial support documents\n\n",
"term" : "Fall Semester (September - December)<br>\nSpring Semester (Ja
uary - May) <br>\nSummer (Different sessions offered between May - August)",
"apply_process_url" : "http://continuingstudies.wisc.edu/visp/applyvisp
htm"
}
>

Microsoft Windows [版本 6.1.7601]
版权所有 (c) 2009 Microsoft Corporation。保留所有权利。

C:\Users\Administrator>d:

D:\>cd D:\developsoftware\MongoDB\bin

D:\developsoftware\MongoDB\bin>net start MongoDB
MongoDB 服务正在启动 .
MongoDB 服务已经启动成功。

D:\developsoftware\MongoDB\bin>mongo.exe
2016-01-09T11:12:44.498+0800 I CONTROL [main] Hotfix KB2731284 or later update
is not installed, will zero-out data files
MongoDB shell version: 3.2.0
connecting to: test
> use shujukuming;
switched to db shujukuming
> db.opportunity.findOne({"id":5});
{
"_id" : ObjectId("5645576c916891242b28318c"),
"id" : 5,
"institute_id" : 300,
"institute" : "University of Wisconsin–?Madison",
"tinstitute" : "威斯康星大学-麦迪逊",
"title" : "Visiting International Student Program",
"type" : 1,
"level" : 4,
"url" : "http://continuingstudies.wisc.edu/visp/index.html",
"introduce" : "Experience UW-Madison student life! The Visiting Internat
ional Student Program (VISP) offers you an opportunity to become an official UW-
Madison student and to take regular university courses with our world-class facu
lty. ",
"benefit" : "1.you may join clubs, use libraries, computer and sports an
d facilities, and have full access to all student support services. <br>\n2.you
will leave UW-Madison with the knowledge you gained and an official transcript o
f the work you completed on our campus. <br>\n3.Your academic work at UW-Madison
may transfer toward your degree program at home or to a degree program in the f
uture. <br>\n4.you’ll be invited to participate in and join activities sponsore
d by the Wisconsin Alumni Association (WAA) international network of over 400,00
0 students worldwide.<br>\n5.The Madison Experience :peaceful places to study an
d explore while experiencing the beauty of our city.",
"to_who" : "",
"apply_fee" : "",
"cost" : "$ 22,305 Fall or Spring (4 Months)<br>\n$46,353 Academic Year
(9 Months)<br>\n$ 5,614 4-Week Session (1 Month)<br>\n$11,178 8-Week Session (2
Months)",
"cost_url" : "http://continuingstudies.wisc.edu/visp/financial-requireme
nts.htm",
"attention" : "",
"apply_url" : "https://uwmadison.qualtrics.com/SE/?SID=SV_0HTPAaHgHK45dU
o",
"deadline" : "Fall : May 1<br>\nSpring : September 1<br>\nSummer (Diffe
rent sessions offered between May - August) : February 1",
"requirement" : "TOEFL: Minimum of 80 for Internet (iBT) and 550 for pap
er test or 213 (computer-based) <br>\nIELTS: Minimum of 6.5<br>\nGPA:3.0<br>\nSc
anned copy of official college transcripts <br>\nScanned copy of passport inform
ation page<br>\nScanned copy of your financial support documents\n\n",
"term" : "Fall Semester (September - December)<br>\nSpring Semester (Jan
uary - May) <br>\nSummer (Different sessions offered between May - August)",
"apply_process_url" : "http://continuingstudies.wisc.edu/visp/applyvisp.
htm"
}
> db.opportunity.findOne({"id":5});
{
"_id" : ObjectId("5645576c916891242b28318c"),
"id" : 5,
"institute_id" : 300,
"institute" : "University of Wisconsin–?Madison",
"tinstitute" : "威斯康星大学-麦迪逊",
"title" : "Visiting International Student Program",
"type" : 1,
"level" : 4,
"url" : "http://continuingstudies.wisc.edu/visp/index.html",
"introduce" : "Experience UW-Madison student life! The Visiting Internat
ional Student Program (VISP) offers you an opportunity to become an official UW-
Madison student and to take regular university courses with our world-class facu
lty. ",
"benefit" : "1.you may join clubs, use libraries, computer and sports an
d facilities, and have full access to all student support services. <br>\n2.you
will leave UW-Madison with the knowledge you gained and an official transcript o
f the work you completed on our campus. <br>\n3.Your academic work at UW-Madison
may transfer toward your degree program at home or to a degree program in the f
uture. <br>\n4.you’ll be invited to participate in and join activities sponsore
d by the Wisconsin Alumni Association (WAA) international network of over 400,00
0 students worldwide.<br>\n5.The Madison Experience :peaceful places to study an
d explore while experiencing the beauty of our city.",
"to_who" : "",
"apply_fee" : "",
"cost" : "$ 22,305 Fall or Spring (4 Months)<br>\n$46,353 Academic Year
(9 Months)<br>\n$ 5,614 4-Week Session (1 Month)<br>\n$11,178 8-Week Session (2
Months)",
"cost_url" : "http://continuingstudies.wisc.edu/visp/financial-requireme
nts.htm",
"attention" : "",
"apply_url" : "https://uwmadison.qualtrics.com/SE/?SID=SV_0HTPAaHgHK45dU
o",
"deadline" : "Fall : May 1<br>\nSpring : September 1<br>\nSummer (Diffe
rent sessions offered between May - August) : February 1",
"requirement" : "TOEFL: Minimum of 80 for Internet (iBT) and 550 for pap
er test or 213 (computer-based) <br>\nIELTS: Minimum of 6.5<br>\nGPA:3.0<br>\nSc
anned copy of official college transcripts <br>\nScanned copy of passport inform
ation page<br>\nScanned copy of your financial support documents\n\n",
"term" : "Fall Semester (September - December)<br>\nSpring Semester (Jan
uary - May) <br>\nSummer (Different sessions offered between May - August)",
"apply_process_url" : "http://continuingstudies.wisc.edu/visp/applyvisp.
htm"
}
>

时间: 2024-10-18 10:55:04

mongo数据库的常见操作的相关文章

【代码学习】MYSQL数据库的常见操作

============================== MYSQL数据库的常见操作 ============================== 一.mysql的连接与关闭 -h:指定所连接的服务器位置 -u:数据库的用户名 -p:数据库的密码 1 mysql -u 用户名 -p //连接数据库 2 密码 3 exit //关闭数据库 1 mysql_connect($host,$user,$password); //连接数据库 2 mysql_close() //关闭数据库 二.创建数据

MySQL数据库的常见操作

1.MySQL数据库的连接与关闭: mysql –h 服务器主机地址 –u 用户名 –p 用户密码 只有客户机所在的主机被授予权限才能去连接MySQL服务器. 注意: 1.每个SQL命令都需要使用分号来完成 2.可以将一行命令拆成多行 3.可以通过\c来取消本行命令 4.可以通过\q.exit.ctrl+c或者quit来退出当前客户端 2.创建新用户并授权 CRANT 权限 ON 数据库.数据表 TO 用户名@登录主机 INDENTIFIED BY "密码" 例如: 添加一个新用户名为

MySQL数据库的常见操作(七)

1.创建数据库 花括号代表必须是要有的,中括号代表是可有可不有,竖线是代表选择,即是从花括号里选择. 继续

mysql数据库访问常见操作

1.登录mysqlmysql -u root -p 2.返回当前日期时间函数:LOCALTIMESTAMP() 或now() 3.删除记录DELETE FROM table_name WHERE condition;举例:delete from temprature_humidity_table where date = "0000-00-00 00:00:00" 4. 插入记录INSERT INTO temprature_humidity_table(date) VALUES(now

mongo数据库基础操作

概念 一个mongod服务可以有建立多个数据库,每个数据库可以有多张表,这里的表名叫collection,每个collection可以存放多个文档(document),每个文档都以BSON(binary json)的形式存放于硬盘中,因此可以存储比较复杂的数据类型.它是以单文档为单位存储的,你可以任意给一个或一批文档新增或删除字段,而不会对其它文档造成影响,这就是所谓的schema-free,这也是文档型数据库最主要的优点.跟一般的key-value数据库不一样的是,它的value中存储了结构信

【MongoDB】windows平台搭建Mongo数据库复制集(类似集群)(三)

关于windows平台搭建Mongo数据库复制集这个话题,我已经在前面写了两篇博客 第一篇: 如何在windows平台搭建Mongo数据库复制集 第二篇: 数据同步和故障自适应测试 在本篇里面,咱们重点总结一下复制集,以及分析一下它的工作原理 一.常见场景 应用程序和数据库之间的网络连接丢失 计划停机.断电.数据库服务硬盘故障等等 复制可以进行故障转移,复制能让你在副本间均衡读负载,保证复制节点与主节点保持同步 二.工作原理 副本集依赖于两个基础机制:oplog和"心跳"(heartb

【MongoDB】windows平台搭建Mongo数据库复制集(类似集群)(转)

原文链接:[MongoDB]windows平台搭建Mongo数据库复制集(类似集群)(一) Replica  Sets(复制集)是在mongodDB1.6版本开始新增的功能,它可以实现故障自动切换和自动修复功能成员节点的功能,各个DB之间的数据完全一致,大大降低了单点故障的风险. [] 以上图示是三个节点的Replica Set架构.该图来源于红丸编写的<Mongodb管理与开发精要>这本书.从上图可以看出,结构类似与一个集群,其实完全可以当做一个集群.因为它确实和集群实现的作用是相同的. 一

mysql数据库和mongodb数据库的相关操作以及两个数据库的区别

在docs命令中执行数据操作 MySQL数据库 先启动MySQL服务器  net start mysql 进入MySQL服务器MySQL -uroot -p(这里写你的数据库密码) (-P是从哪个端口进) 我第一次操作是就是因为电脑上 有 MySQL  MySQL57 MySQLla 三个服务 引起端口冲突 导致 我 找不到相应的数据 数据库操作 create database   创建数据库 show databases   显示MySQL服务上的数据库 use  数据库          使

【转载】数据库大并发操作要考虑死锁和锁的性能问题

本文转载自:http://blog.csdn.net/yuanyuanispeak/article/details/52756167 1 前言 数据库大并发操作要考虑死锁和锁的性能问题.看到网上大多语焉不详(尤其更新锁),所以这里做个简明解释,为下面描述方便,这里用T1代表一个数据库执行请求,T2代表另一个请求,也可以理解为T1为一个线程,T2 为另一个线程.T3,T4以此类推.下面以SQL Server(2005)为例. 2 锁的种类 共享锁(Shared lock). 例1: -------