【第22期】观点:IT 行业加班,到底有没有价值?

mongoDB--简单操作

原创 2016年08月30日 10:45:14

1.打开控制台

1.cd mongodb-osx-x86_64-2.6.9/bin
2../mongod  mongodb 不能关闭控制台

2.新开控制台

1.cd mongodb-osx-x86_64-2.6.9/bin
2.登录管理mongodb,./mongo

3基本命令:

show dbs   查看现有数据库

4.use +数据库名字(自动创建)

5.show collections (展示数据库所有的集合<对应于关系型数据库的表>)

6· db.loopbacktest.find().pretty() (查询表中所有数据findone是查一条)

7.其他命令

LiuHaiYangdeMacBook-Pro:bin PersnHome$ ./mongo
MongoDB shell version: 2.6.9
connecting to: test
Server has startup warnings: 
2016-05-14T17:40:19.697+0800 [initandlisten] 
2016-05-14T17:40:19.697+0800 [initandlisten] ** WARNING: soft rlimits too low. Number of files is 256, should be at least 1000
> show dbs
admin     0.078GB
hyt_zsyy  0.078GB
local     0.078GB
> use hyt_zsyy
switched to db hyt_zsyy
> show collections
admins
doctor_schedules
hospitals
registrations
system.indexes
users
verify_codes
> 
> db.users.
db.users.aggregate(                  db.users.getSplitKeysForChunks(
db.users.clean(                      db.users.getWriteConcern(
db.users.constructor                 db.users.group(
db.users.convertToCapped(            db.users.groupcmd(
db.users.convertToSingleObject(      db.users.hasOwnProperty(
db.users.copyTo(                     db.users.help(
db.users.count(                      db.users.indexStats(
db.users.createIndex(                db.users.initializeOrderedBulkOp(
db.users.dataSize(                   db.users.initializeUnorderedBulkOp(
db.users.diskStorageStats(           db.users.insert(
db.users.distinct(                   db.users.isCapped(
db.users.drop(                       db.users.mapReduce(
db.users.dropIndex(                  db.users.pagesInRAM(
db.users.dropIndexes(                db.users.propertyIsEnumerable(
db.users.ensureIndex(                db.users.prototype
db.users.exists(                     db.users.reIndex(
db.users.find(                       db.users.remove(
db.users.findAndModify(              db.users.renameCollection(
db.users.findOne(                    db.users.runCommand(
db.users.getCollection(              db.users.save(
db.users.getDB(                      db.users.setSlaveOk(
db.users.getDiskStorageStats(        db.users.setWriteConcern(
db.users.getFullName(                db.users.shellPrint(
db.users.getIndexKeys(               db.users.stats(
db.users.getIndexSpecs(              db.users.storageSize(
db.users.getIndexStats(              db.users.toLocaleString(
db.users.getIndexes(                 db.users.toString(
db.users.getIndices(                 db.users.tojson(
db.users.getMongo(                   db.users.totalIndexSize(
db.users.getName(                    db.users.totalSize(
db.users.getPagesInRAM(              db.users.unsetWriteConcern(
db.users.getPlanCache(               db.users.update(
db.users.getQueryOptions(            db.users.validate(
db.users.getShardDistribution(       db.users.valueOf(
db.users.getShardVersion(            db.users.verify(
db.users.getSlaveOk(
> db.users.find();
{ "_id" : ObjectId("5732ffadefff83e1117de101"), "password_original" : "test", "password" : "test", "name" : "test", "deleted_at" : null, "updated_at" : ISODate("2016-05-11T09:47:25.143Z"), "created_at" : ISODate("2016-05-11T09:47:25.143Z"), "patient" : [ { "_id" : ObjectId("5732ffadefff83e1117de102"), "idcard" : "653130199201141458", "phone" : "18612233895", "name" : "test" } ], "idcard" : "653130199201141458", "address" : "", "email" : "", "phone" : "18612233895", "__v" : 0 }
{ "_id" : ObjectId("573427653baecec708a748d6"), "password_original" : "123456", "password" : "e10adc3949ba59abbe56e057f20f883e", "name" : "kkk", "deleted_at" : null, "updated_at" : ISODate("2016-05-12T06:49:09.038Z"), "created_at" : ISODate("2016-05-12T06:49:09.038Z"), "patient" : [ { "name" : "kkk", "phone" : "18847451913", "idcard" : "511523198702112410", "_id" : ObjectId("573427653baecec708a748d7") } ], "idcard" : "511523198702112410", "address" : "", "email" : "", "phone" : "18847451913", "__v" : 0, "weichatID" : "18847451913", "SickID" : "6001491388" 
303724147}
> db.users.find().pretty;
function (){
    this._prettyShell = true;
    return this;
}
> use new_db
switched to db new_db
> db.createUser({user:'haiyang',pwd:'haiyang',roles:[{role:'dbOwner',db:'new_db'}]});
Successfully added user: {
    "user" : "haiyang",
    "roles" : [
        {
            "role" : "dbOwner",
            "db" : "new_db"
        }
    ]
}
> db.auth('haiyang','haiyang')
1
> show dbs
admin     0.078GB
hyt_zsyy  0.078GB
local     0.078GB
new_db    (empty)
> 
> use hyt_rmyy
switched to db hyt_rmyy
> 
> 
> 
> use hyt_rmyy
switched to db hyt_rmyy
> 
> db.createUser({"user":"hyt_rmyy","pwd":"hyt_rmyy_pw",roles:[{"role":"dbOwner","db":"hyt_rmyy"}]})
Successfully added user: {
    "user" : "hyt_rmyy",
    "roles" : [
        {
            "role" : "dbOwner",
            "db" : "hyt_rmyy"
        }
    ]
}
> 
> 
版权声明:欢迎转载! 举报

相关文章推荐

MongoDB基本操作

登录 [root@logs ~]# mongo -u loguser -p log123456 --authenticationDatabase admin MongoDB shell versi...

学习MongoDB 一:MongoDB 入门(安装与配置)

学习MongoDB 一:MongoDB 入门(安装与配置)                                                    ...
  • jin_z
  • jin_z
  • 2017-08-03 11:22
  • 67

程序员升职加薪指南!还缺一个“证”!

CSDN出品,立即查看!

MongoDB常用命令

MongoDB是一个基于文档的开源数据库,其摒弃了传统的对象关系模型(Object Relational Mapping)来提高开发效率。 在MongoDB中用文档(document)来表示一条记录,...

C# mongodb 驱动操作(Z)

Query.All("name", "a", "b");//通过多个元素来匹配数组 Query.And(Query.EQ("name", "a"), Query.EQ("title", "t"));...

mongodb

1 use demodb //使用demodb,以下假设操作的collection是foo 2 db.foo.remove({"id":"bar"}) //删除一条数据 3 db.foo.remo...

MongoDB 在 Win7 64bit + VS2013 使用

简介 MongoDB 是一个由C++语言编写的、基于分布式文件存储的开源数据库系统,其旨在为WEB应用提供可扩展的高性能数据存储解决方案。 MongoDB 将数据存储为一个文档,数据结构由键值(k...

Mongodb的简单操作方法

MongoDB数据库属于一种非关系型的数据库,对数据的存储主要是以键值对的方式存储,而且在很大程度上提高了数据的存取时间和效率,简单总结了下Mongodb的操作方法。 首先我是使用samus驱动实现...

mongodb集合的简单操作

MongoDB是一个基于分布式文件存储的数据库。由C++语言编写。旨在为WEB应用提供可扩展的高性能数据存储解决方案。    MongoDB是一个高性能,开源,无模式的文档型数据库,是当前NoSql...
收藏助手
不良信息举报
您举报文章:深度学习:神经网络中的前向传播和反向传播算法推导
举报原因:
原因补充:

(最多只允许输入30个字)