![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据库
梅雨琪
一只美丽认真的程序媛!
展开
-
【mongo】命令修改字段名称
db.collection.update({}, {"$rename":{"oriName": "newName"}}, false, true)原创 2019-12-18 19:54:45 · 270 阅读 · 0 评论 -
【mongo】命令修改集合名称
db.collection.renameCollection("NewCollectionName")原创 2019-12-18 19:53:49 · 2429 阅读 · 0 评论 -
【mongo】命令给collection添加一列字段并设置初始值
db.collection.update({},{"$set":{"filed":0}},false,true)原创 2019-12-18 19:52:39 · 1458 阅读 · 0 评论 -
【mongo】 命令修改字段类型
命令行修改集合内字段的数据类型:db.collection.find().forEach(function (x) {x.filed = parseInt(x.filed); # parseInt 转为doublex.filed = NumberInt(x.filed); # NumberInt 转为intx.filed = new ISODate(x.file...原创 2019-12-18 19:51:07 · 425 阅读 · 0 评论 -
reids配置文件详细解读(中文翻译)
#daemonize no 默认情况下, redis 不是在后台运行的,如果需要在后台运行,把该项的值更改为 yesdaemonize yes# 当 redis 在后台运行的时候, Redis 默认会把 pid 文件放在 /var/run/redis.pid ,你可以配置到其他地址。# 当运行多个 redis 服务时,需要指定不同的 pid 文件和端口pidfile /var/run...转载 2019-07-15 17:44:45 · 162 阅读 · 0 评论 -
将redis-server添加到Linux启动项
修改/etc/rc.local脚本举例:将redis-server添加到启动项vim /etc/rc.local /etc/rc.local 脚本内容如下:#!/bin/sh## This script will be executed *after* all the other init scripts.# You can put your own initialization ...原创 2019-07-15 17:40:38 · 428 阅读 · 0 评论 -
Centos上 Mongodb的主从配置,最简单有效的方法(详细过程+常见报错解析)
一、安装参考文档https://www.jianshu.com/p/994bc7b19b26二、配置主从(一)切换到mongo所在的bin目录下,后面操作全部在bin下进行命令: cd /usr/mongodb/mongodb-linux-x86_64-3.4.18/bin (根据个人的mongo位置进行切换)(二)修改主、从、仲裁节点配置文件命令:vi mongodb.c...原创 2019-12-13 13:03:48 · 1556 阅读 · 0 评论 -
MongoDB修改数据库名的命令行操作,一行命令解决!
第一步:进入mongo操作界面# mongo第二步: 选择你要重命名的数据库# use yourdatabase第三步: 使用管理员权限# use admin第四步:转移数据库的集合到新命名的数据库# db.runCommand({"renameCollection":"yourdbname.yourcollection", "to":"newdbname.yourcollectio...原创 2019-12-01 16:36:29 · 2138 阅读 · 0 评论 -
【Python】使用pymongo访问MongoDB的(增/删/改/查)基本操作
1. 环境。Python:3.6.1Python IDE:pycharm系统:win72. 简单示例import pymongo# mongodb服务的地址和端口号mongo_url = "127.0.0.1:27017"# 连接到mongodb,如果参数不填,默认为“localhost:27017”client = pymongo.MongoClient(mongo_url...转载 2019-06-03 16:09:37 · 1102 阅读 · 0 评论