Because of the Springboot + mongotemplate used in the project, it is still necessary to mongotemplate operation modeFirst create a bean:Package Com.iwhere.easy.travel.entity;import Java.io.serializable;import java.util.arrays;import
Here's a record of what MongoDB often commandsDatabase relatedCreate a databaseUse database_nameIf the database does not exist, create the database, or switch to the specified database.Delete database : Switch to the database you want to delete,
1. MongoDB Installation on Mac
Download mongodb,https://www.mongodb.org/
Unzip to a specified folder, such as:/users/enniu1/desktop/zjg/mongodb-osx-x86_64-3.2.6 (This is the version of my MongoDB)
Configure path
Input
Create a collection to hold _idDb.createcollection ("counters")Add fields that require self-increment{ "_id": "ProductID", "Sequence_value": 0}Then add the self-increment JS method in the MongoDB library Getnextsequencevaluefunction (sequencename)
First, MongoDB1. InstallationBecause the download installation with Yum source always times out, the Tarball mode installation is selected.Official installation Method Link, https://docs.mongodb.com/manual/tutorial/install-mongodb-on-linux/1.
Mongoexport export JSON or CSV format
Mongoimport Import JSON or CSV
Mongodump Export binary Bson structure data and index information
Mongorestore Importing binary files
Mongoexport-h 主机--port 端口号-u 用户名-p password-d 库名-c 表名-f field1
Data storage is a very important part of the entire system, in MySQL, Redis has a master-slave architecture, to a certain extent, to ensure the security of data and high availability, and MongoDB is also the implementation of this way. Master-Slave
Chapter III index operations and performance testingThe importance of indexes under big data is not much to say.The following test used a MongoDB client tool Robomongo, you can choose to download on the Internet. Official website:
One: The export function of MongoDBMongoDB provides the ability to import and export, respectively, the Mongoexport.exe and Mongoimport.exe files in the MongoDB download directory, the specific Export command format is as follows:Mongoexport-h
Mongodb3.0 new FeaturesWiredtigerMMAPv1Pluggable Engine APIWeb-based visual management toolsView version numberMongod--versionStart the databaseMongod--dbpath $dbpath--logpath $logpath--logappend--fork--port= 27000$dbpath Data Catalog$logpath is the
Additional commands:1. Enter the front-end Operation command./mongo [IP: Port]Description: Local is automatically selected by default, Port 270172. Show All libraries> Show DBS; or show databases;3. Select Library> Use library name;4. Display all
Higher write loadBy default, MongoDB is more concerned with high insertion speeds than transaction security. If you need to load a lot of low-value business data, such as log collection, then MongoDB will work well for your use case, but you must
View all databases:> Show DBS;Select a database:> Use ECommerce;To view the current database status:> Db.stats ();To view all the collections in the current database:> Show Collections;To view the collection status:> DB. Toperatelog.stats (1024)To
1.mongodb BackupThe Mongodump command can use a list of available options.This command backs up only the specified database, in the specified path
Grammar
Description
Example
Mongodump--host host_name--port
MongoDB do cluster, version 3.2 of the recommended cluster mode replica set preparation server 3 two standard node (these two nodes directly can be mutually primary secondary). A arbiter node, holding a ballot in its hand, determines which of the
This blog explains how to build a multiplayer blog, which requires a certain amount of basic knowledge for thought-finishing and memo-writing.The first step: Create a new folder blog, the structure is as follows:
The bin---executable binary,
Services run on the line will generate a large number of running and access logs, the log will contain some errors, warnings, and user behavior information, usually the service will be in the form of text log information, so readable, convenient for
The performance test of MONGODB billion data volume was carried out, and the following items were tested:(All inserts are single-threaded and all reads are multithreaded)1) Normal insertion performance (the inserted data is about 1KB per piece)2)
MongoDB Configuration Master-slave replication is much simpler than MySQL1, install, start with the configuration file2. Modify the configuration fileConfiguration of the Master[Email protected] mongodb]#
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service