Category:MongoDB

  • Installation and use of mongodb in Windows

    Time:2019-12-9

    First, install mongodb 1. Download address: http://www.mongodb.org/downloads 2. Extract it to the directory you want to install, such as D: \ mongodb 3. Create folders D: \ mongodb \ data \ dB and D: \ mongodb \ data \ log, which are used to install dB and log files respectively. Create a log file mongodb.log […]

  • Mongodb quick start notes (7) mongodb user management operations

    Time:2019-12-8

    Introduction to mongodb Mongodb is a database based on distributed file storage. Written in C + +. It aims to provide scalable high-performance data storage solutions for web applications. Mongodb is a product between relational database and non relational database. It has the most abundant functions and is the most like relational database. 1. Users […]

  • Backup and recovery of mongodb data in windows or Linux system

    Time:2019-12-7

    Mongodb database backup and recovery under Windows I can say that the data is backed up to the directory C: \ data \ dump. First, create this path. Then go to the bin directory of mongodb Mine is: C:\Program Files\mongodb\bin The backup script is: // backup mongodump -h 127.0.0.1:27017 -d test -o c:\data\dump The recovery […]

  • Mongodb using the command line tools for backup and recovery

    Time:2019-12-6

    To back up a database, mongorestore -d db /path/to/back_up For example: mongodump -d bookstore -o /data01/db_backup/ This command will dump all the collections of the DB Recover data from backup folder mongorestore -d bookstore /data01/db_backup/bookstore Back up or reply to the specified collection only Take the statistics table in the bookstore DB as an example […]

  • Explain how to clear the extra disk space occupied by mongodb

    Time:2019-12-5

    The first point is that mongodb will not release the occupied hard disk space, even drop collection, unless drop database. If a DB once had a large amount of data deleted after a period of time, hard disk space is a problem. How to recover the extra space occupied by mongdodb? There are two ways […]

  • Master slave mode configuration of mongodb and key points of master slave replication

    Time:2019-12-4

    Master slave configuration The master slave mode of mongodb is configured as follows 1.keyFile Generate key file openssl rand -base64 741 > mongo_key Place mongo_key where master and slave mongodb users can access.Setting permissions chmod 700 mongo_key Set up onwer chown mongodb:nogroup mongo_key 2. Master configuration Edit / etc / mongodb.conf and set it as […]

  • How to create and delete sets in mongodb

    Time:2019-12-3

    Create collection: createcollection() method MongoDB db.createCollection(name, options) Is used to create a collection Syntax:The basic createcollection() command syntax is as follows: db.createCollection(name, options) In the command, name is the name of the collection to be created. Options is a file that specifies the configured collection parameter type describe Name String Collection name to create Options […]

  • Summary of basic operation methods of adding, deleting, querying and modifying documents in mongodb

    Time:2019-12-2

    Insert document: insert () method To insert data into the mongodb collection, you need to use mongodb’s insert() or save() methods. Syntax: The basic syntax of the insert() command is as follows: >db.COLLECTION_NAME.insert(document) Example: >db.mycol.insert({    _id: ObjectId(7df78ad8902c),    title: ‘MongoDB Overview’,     description: ‘MongoDB is no sql database’,    by: ‘tutorials point’,    url: ‘//www.jb51.net’,    tags: [‘mongodb’, ‘database’, ‘NoSQL’],    […]

  • Mongodb’s aggregation framework

    Time:2019-12-1

    1. Aggregation framework Using the aggregation framework to transform and combine the documents in the collection, you can create a pipeline with multiple components for processing a series of documents. These components include filtering, projecting, grouping, sorting, limiting and skipping.For example, if you want to find the most animals in a collection of animal types, […]

  • Mongodb + PHP for simple addition, deletion, modification and query

    Time:2019-11-30

    PHP extension of mongodb on Windows Download address: https://s3.amazon aws.com/drivers.mongodb.org/php/index.html Find the DLL file of the corresponding PHP version and download itphp_mongo.dll, put it into the EXT directory under the PHP installation directory, modify php.ini, and add an itemextension=php_mongo.dll, no DLL found to support php7 Get the mongoclient object and get it from New Get […]

  • A tutorial of mongodb copying databases and collections between different hosts

    Time:2019-11-29

    1. db.cloneCollection() db.cloneCollection(from, collection, query)To copy data between different mongodb instances, db.clonecollection is an external embodiment of the clonecollection database command. function (from, collection, query) { assert( isString(from) && from.length ); assert( isString(collection) && collection.length ); collection = this._name + “.” + collection; query = query || {}; return this._dbCommand( { cloneCollection:collection, from:from, query:query } […]

  • Summary of mongodb basic installation and management command script

    Time:2019-11-28

    install 1. Install mongodb on Linux1.1 create data directory and log file: mkdir -p /data/node/ touch /data/mongodb.log 1.2 install mongodb: tar zxf mongodb-linux-x86_64-2.4.9.tgz mv mongodb-linux-x86_64-2.4.9 /opt/mongodb echo “export PATH=$PATH:/opt/mongodb/bin” >>/etc/profile source /etc/profile 1.3 create a new slave node profile: cat >> ~/.mongodb.conf <<EOF fork = ture port = 11000 dbpath = /data/node logpath = /data/mongodb.log […]