• Mongodb Basics


    Micro services are popular. I also like mongodb more and more. Unless MySQL is necessary, I prefer mongodb. MongoDB What is MongoDB? Mongodb is written in C + +, which is an open source database system based on distributed file storage. In the case of high load, adding more nodes can guarantee the server performance. […]

  • Some common query methods of mongodb


    Query. All (“name”, “a”, “B”); // match arrays by multiple elements Query. And (query. EQ (“name”, “a”), query. EQ (“title”, “t”)); // multiple conditions are met at the same time Query. EQ (“name”, “a”); // equals Query. Exists (“type”, true); // judge whether the key value exists Query. GT (“value”, 2); // greater than > […]

  • 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 […]

  • [get to know mongodb 1 in five minutes] change stream and mongodb 4. X


    Fully aware of the data changes in the database is the key point for data synchronization from mongodb to other data services. Compared with querying collection directly to get data changes, streaming monitoring is more effective and timely. This is a very powerful “responsive programming” mode. With the version update of mongodb, the streaming method […]

  • Pymongo basic operation instruction


    1. Create a connection import pymongo Conn = pymongo. Mongoclient (‘localhost ‘, 27017) 񖓿 after the installation and start of the service, the default local connection Conn = pymongo. Mongoclient() defaults to the above address and port Conn = pymongo. Mongoclient() 񖓿 connect to the database DB = conn [‘like’u name ‘] (get database with […]

  • 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 […]

  • [learn mongodb 2 in five minutes] why to choose document data structure


    Document data structure is the natural expression of data. We only split the data into rows and columns in the 1970s to optimize data access. At that time, due to the high price of storage and computing power, it is meaningful to spend developers’ time to reduce and break up data into rows and columns, […]

  • 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 development series – the impact of replica sets on program development


    This article mainly explains the impact of replica set architecture on program development from the following aspects The author divides the application development based on mongodb into two stages: software operation and maintenance and software development This article will focus on the practical experience sharing in the later stage Understanding replica set and master-slave structure […]

  • 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 […]

  • Front end monitoring (user behavior tracking, resource loading details)


    The so-called web, even if you and I haven’t met before, knows that we share the same interests; even if we don’t leave home, we know that the world is big. Long time no see, can I miss you? The front-end monitoring system adds user behavior tracking and resource loading details, so what is user […]

  • How to build mongodb partition (no master-slave)


    First, prepare mongodb on the server running the sharding. We need to plan: A configuration server is used to store partition information and coordinate data storage; Several slicing servers are used to save the data itself; A broker server, which is used to perform sharding operations and is also the access portal of the client. […]