• Examples of using MapReduce in mongodb learning notes


    1、 MapReduce is grouped according to the first parameter of the emit function called in the map function Map reduce is a kind of calculation model, which is simply to execute a large amount of work (data) decomposition (map), and then merge the results into the final result (reduce). To use MapReduce, you need to […]

  • Introduction to gridfs of mongodb learning notes


    GridFS introduction Gridfs is a built-in function in mongodb, which can be used to store a large number of small files. GridFS use Mongodb provides a command-line tool mongofiles to handle gridfs, List all files: Copy codeThe code is as follows: mongofiles list Upload a file: Copy codeThe code is as follows: mongofiles put xxx.txt […]

  • Examples of using mongodb learning notes in groups


    //Prepare test data db.user.drop(); for(var i=10; i< 100; i++) { db.user.insert({ name:”user” + i, age : Math.floor(Math.random()*10)+ 20, sex : Math.floor(Math.random()*3)%2 ==0 ? ‘M’ : ‘F’, chinese : Math.floor(Math.random()*50)+50, math : Math.floor(Math.random()*50)+50, english : Math.floor(Math.random()*50)+50, class : “C” + i%5 }) } //Group function //Group by class and display the user name and gender in […]

  • Mongodb backup, restore, export, import, clone operation example


    Database backup – mongodump Back up all local mongodb databases: Copy codeThe code is as follows: # mongodump -h –port 27017 -o /root/db/alldb Back up the remote specified database: Copy codeThe code is as follows: # mongodump -h –port 27018 -d yourdb -o /root/db/yourdb More about mongodump Database restore – mongorestore Restore all […]

  • Mongo management user related operation summary


    List all users Copy codeThe code is as follows: mongo use admin db.system.users.find() Disable authentication mode Copy codeThe code is as follows: /etc/mongod.conf noauth = true auth = false Create user The user is database based, and the user created on the admin database belongs to the administrator user. Manager user creation Users with all […]

  • Detailed explanation of mongostat, a mongostat monitoring and performance analysis tool


    The purpose of this article is to let you know how to know if mongdb you are running is healthy. Mongostat details Mongostat is a state detection tool of mongdb, which is used at the command line. It will get the current running state of mongodb at regular intervals and output. If you find that […]

  • A summary of mongodb in NoSQL


    NoSQL has been popular for a long time, so in what scenarios do you need to use these “emerging things”, such as mongodb? Here are some summary: You expect a higher write load By default, mongodb pays more attention to high insertion speed than transaction security. If you need to load a large amount of […]

  • Teach you 8 days to learn mongodb — the first day basic introduction


    There are three elements in mongodb: database, collection, document, and “collection” It corresponds to the table in the relational database and the document corresponds to the row. 1: Download On the mongodb official website, we found that there are 32bit and 64bit, which depends on your system, but here are two points: ① According to […]

  • How to optimize the performance of mongodb (five simple steps)


    Mongodb has always been the most popular NoSQL. According to the latest ranking of DB engines ranking, mongodb has now beat PostgreSQL to rank the fourth in the total ranking of databases, next to Oracle, MySQL and Microsoft SQL server. This paper summarizes how to optimize the performance of mongodb Have you ever encountered performance […]

  • How to use the JavaScript script of mongodb server


    Common JavaScript statements Copy codeThe code is as follows: db.getSiblingDB(<dbname>)   db.getCollectionNames()    db.getCollection(<collname>)    db.printCollectionStats() Running JavaScript script in Mongo shell  Switch database: Copy codeThe code is as follows: use <dbname> Run the following script: var total = 0; var dbaStatCollections = function(){}; dbaStatCollections = function(){ collNames = db.getCollectionNames(); for (var index = 0; index < collNames.length; […]

  • Installing and using mongodb database in PHP


    In the traditional database, we need to write a large number of SQL statements to operate the database data, and in the storage of irregular data, the processing of different fields in the traditional relational database is also weak, Mongo came into being, and the wide application of Ajax technology, the wide acceptance of JSON […]

  • Mongodb data type and mongoose common curd


    Preface After reading the actual battle of node.js, redis and mongodb are mentioned in the data storage part. I also wrote several simple demos according to the introduction in the book. The first problem encountered in the process of demo is data type and common curd writing method. There are two common ways to operate […]