MongoDB相关资料收集

时间:2022-09-03 08:44:05

MongoDB 入门教程
http://www.runoob.com/mongodb/mongodb-tutorial.html

.net 驱动程序下载:
http://mongodb.github.io/mongo-csharp-driver/

https://www.nuget.org/packages/MongoDB.Driver/2.2.3

MongoVUE无法看到collection明细记录的解决方法

MongoDB 3.2之后默认启动的是wiredTiger 引擎这个引擎和原来的引擎访问方式不一样。你用命令mongod  --storageEngine mmapv1 --dbpath 数据目录 这样启动的是原来的数据引擎在用MongoVE连接就可以了

 详见:http://my.oschina.net/chiyong/blog/599326?fromerr=I2dldtre

ps,wiredTiger为新版存储引擎,性能比mmapv1 要好,启用压缩后,占用的存储空间按比mmapv1小。详见:http://my.oschina.net/chiyong/blog/599326?fromerr=I2dldtre

其他更好的方法,用Robomongo替换MongoVE,可以支持两种存储引擎。

setup.bat

cd C:\Program Files\MongoDB\Server\3.2\bin
mongod.exe --storageEngine mmapv1 --logpath "C:\temp\mongodb\log\mongodb.log" --logappend --dbpath "C:\temp\mongodb\data" --port 6111 --serviceName "MongoDB" --serviceDisplayName "MongoDB Server" --install net start MongoDB pause

remove.bat

cd C:\Program Files\MongoDB\Server\3.2\bin
mongod.exe --storageEngine mmapv1 --logpath "C:\temp\mongodb\log\mongodb.log" --logappend --dbpath "C:\temp\mongodb\data" --port --serviceName "MongoDB" --serviceDisplayName "MongoDB Server" --install net start MongoDB pause

MongoDB安全相关,服务启动加参数 --auth,设置用户名密码,见官方文档:https://docs.mongodb.com/manual/reference/method/db.createUser/

> db.createUser({user:"wilson",pwd:"",roles:[]})
Successfully added user: { "user" : "wilson", "roles" : [ ] }
>

加了验证后的访问url为:

"mongodb://user1:123@192.168.160.132/dbdemo1/?socketTimeout=1s";
db.createUser( { user: "admin",
pwd: "admin123",
roles: [ { role: "readWrite", db: "gps_current_ps" },
{ role: "readWrite", db: "ob_active_ps" },
{ role: "readWrite", db: "StudentDB" }
]} ) db.auth( {
user: "admin",
pwd: "admin123",
} )

使用MongoDB.Driver.GridFS进行文件读写操作

using System.IO;
using System.Linq;
using System.Text;
using MongoDB.Driver;
using MongoDB.Driver.GridFS;
static void Main(string[] args)
{
string mongoUrl = "mongodb://192.168.0.226:6111/?socketTimeout=1s";
MongoServerSettings setting = MongoServerSettings.FromUrl(MongoUrl.Create(mongoUrl)); MongoServer server = new MongoServer(setting); MongoGridFSSettings settting2 = new MongoGridFSSettings(); MongoGridFS fs = new MongoGridFS(server, "StudentDB", settting2); MongoGridFSFileInfo fi = fs.Upload("c:\\test.doc", "中文测试.doc"); byte[] buffer = new byte[];
using (MongoGridFSStream readStream = fs.OpenRead("中文测试.doc"))
{
FileStream writeStream = new FileStream("c:\\20160601.doc", FileMode.OpenOrCreate);
int length = readStream.Read(buffer,,buffer.Length);
while(length>)
{
writeStream.Write(buffer, , length);
length = readStream.Read(buffer,,buffer.Length);
}
}
db.getCollection('fs.files').find({})

db.getCollection('fs.chunks').find({})

写入成功后,文件保存在files及chunks两个集合

MongoDB相关资料收集

MongoDB相关资料收集

db.createUser( { user: "psuser",
pwd: "tydbadmin",
roles: [ { role: "readWrite", db: "gps_current_ps" },
{ role: "readWrite", db: "ob_active_ps" },
{ role: "readWrite", db: "StudentDB" },
{ role: "dbAdmin", db: "gps_current_ps" },
{ role: "dbAdmin", db: "ob_active_ps" },
{ role: "dbAdmin", db: "StudentDB" },
]} ) db.auth( {
user: "psuser",
pwd: "tydbadmin",
} ) db.auth( {
user: "admin",
pwd: "admin123",
} ) db.collection.createIndex( {ObjID:, Date: } )
db.collection.createIndex( {Date: } ) db.collection.createIndex( { orderDate: } )

MongoDB相关资料收集的更多相关文章

  1. AssetBundle机制相关资料收集

    原地址:http://www.cnblogs.com/realtimepixels/p/3652075.html AssetBundle机制相关资料收集 最近网友通过网站搜索Unity3D在手机及其他 ...

  2. FastAdmin 导出 Excel 相关资料收集 (2018-08-14)

    FastAdmin 导出 Excel 相关资料收集 导出 Excel 文件时身份证号变成科学计数法怎么办? https://forum.fastadmin.net/thread/1346 姊妹篇 Fa ...

  3. FastAdmin 导入 Excel 相关资料收集 (2018-08-14)

    FastAdmin 导入 Excel 相关资料收集 新版本一键CRUD后自带导入功能,但是默认被禁用,如何启动 https://forum.fastadmin.net/thread/540 Excel ...

  4. iOS10以及xCode8相关资料收集

    兼容iOS 10 资料整理笔记 源文:http://www.jianshu.com/p/0cc7aad638d9 1.Notification(通知) 自从Notification被引入之后,苹果就不 ...

  5. 【原】Mongodb相关资料

    Mongodb与关系型数据库对比 Mongodb与关系型数据库对比 由于之前主要接触的是关系型数据库,所以主要将Mongodb与关系型数据库进行对比:主要从术语.Server与Client.数据定义语 ...

  6. MPEG 编解码相关资料收集

    以下是我搜集的关于MPEG1/2的编解码相关的资料: (注:mpge帧内编码是基于jpeg编码的,所以请务必先理解jpeg的编解码原理.) 1:Introduction to MPEG 2 Video ...

  7. MongoDB相关资料

    MongoDB的介绍及安装参考http://www.cnblogs.com/lipan/archive/2011/03/08/1966463.html 安装过程: 第一步:下载安装包:官方下载地址←单 ...

  8. kafka负载均衡相关资料收集(二)

    [转]关于kafka producer 分区策略的思考 from:http://blog.csdn.net/ouyang111222/article/details/51086037 今天跑了一个简单 ...

  9. kafka负载均衡相关资料收集(一)

    key为null时Kafka会将消息发送给哪个分区? 当你编写kafka Producer时, 会生成KeyedMessage对象. 1 KeyedMessage<K, V> keyedM ...

随机推荐

  1. 二、JavaScript语言--JS动画--JS动画效果

    运动框架实现思路: 1.速度(改变值:left , right , width , height , opacity) 2.缓冲运动 3.多物体运动 4.任意值改变 5.链式运动 6.同时运动 js用 ...

  2. Java for LeetCode 041 First Missing Positive

    Given an unsorted integer array, find the first missing positive integer. For example, Given [1,2,0] ...

  3. IOS做一个简单计算器

    //声明非原创 步骤: 1.打开Xcode,单机Creat a new Xcode project 2.左边选择ios下Application,右边选择single view Application ...

  4. CSS 待解决问题

    记录一些待解决的问题 1. 关于 table 边框参差不齐问题 乍一看表头的边框有 间隙, 下边框也有点没有对其的问题. 解决方案:  给 table 添加: border-collapse: col ...

  5. eclipse的常用快捷键和一些基本设置!!!

    对于一些比较繁琐简单的代码没必要天天敲,为了提高效率,还是需要使用一些快捷键的:下面就说了一些比较基本的. alt+shift+s+c     无参构造器 alt+shift+s+O    有参构造器 ...

  6. activiti实战系列 排他网关(ExclusiveGateWay)

    流程图 12.2:部署流程定义+启动流程实例 12.3:查询我的个人任务 12.4:完成我的个人任务 说明: 1)     一个排他网关对应一个以上的顺序流 2)     由排他网关流出的顺序流都有个 ...

  7. CentOS 7 最小化安装配置以及网络服务器搭建、配置与管理

    一.环境介绍: 运行软件:VMware Workstation Pro 系统环境:CentOS-7-x86_64-1810 系统网络运行模式:NAT模式 二.操作配置: 1.配置动态获取IP 1) 修 ...

  8. Startup 类

    Startup 类的作用: 配置应用所需的任何服务 定义请求处理管道 配置(或注册)服务的代码添加到Startup.ConfigureServices方法中.服务是应用使用的组件.例如,Entity ...

  9. execve函数的介绍与使用

    #include<stdio.h> #include<unistd.h> int main() { char *filename[]={"./BP",NUL ...

  10. MySQL存储过程相互调用

    什么都不说了上代码: 方式一: 第一个存储过程:test1,参数如下:IN `user_name` VARCHAR(50),OUT `uid`  bigint(20) BEGIN #Routine b ...