MongoDB 3.0.6 installation and additions and modifications

Source: Internet
Author: User

    Download

Install package MSI

http://yunpan.cn/cmhHdTPkXZRM2 access password 9b6c

The above is provided with a MongoDB 3.0.6 64Bit installation package

    Installation

If you do not want to install directly on the C drive. You should choose Custom Installation.

is to select the all installation and customization step. All installations are installed by default on the C drive.

I am here to install the D:\Program files\mongodb\mongodb .

You need to create a new Log folder under D:\Program files\mongodb ... and create the Log.txt file under Log. Logs generated by the installation of the Sheng-

Also create a new Data folder under D:\Program Files\mongodb. The database file created after the bloom. These two folders can be customized in the location.

Open the cmd window and enter the following command


 >   D:  2 . >   CD D:\Program files\mongodb\mongodb  3 . >  mongod.exe install--logpath   "D:\Program files\mongodb\ Log\log.txt " --dbpath  " D:\Program Files \mongodb\data "The //logpath parameter cannot be omitted. This file must be available locally before installation DBPath is the specified database in the directory  4 . >  Net start MongoDB// Open service can also start manually in the list of services  

Comes with a MongoDB parameter description

mongod parameter Description: dbpath: The data file storage path in which each database creates a subdirectory that prevents the mongod.lock of the same instance from running multiple times from being saved in this directory. LogPath: Error log file. Logappend: Error log with append no mode (default is overwrite mode). BIND_IP: The binding IP of the external service, which is generally set to null, and is bound to the available IP on this machine, and can be specified separately if necessary. PORT: External service port, Web management port on the basis of this port + +. Fork: After the daemon form of Operation service. Journal: Turn on the log function, save the operation log to reduce the recovery time of single machine failure, after the 1.8 version formally joined, replaced in 1. 7 the Dur parameter in the. 5 release. Syncdelay: The time of the system to flush the disk synchronously, in seconds, the default is 60 seconds. DIRECTORYPERDB: Each db is stored in a separate directory, it is recommended to set this parameter. Maxconns: Maximum number of connections. Repairpath: temporary directory when executing repair. If the journal is not turned on, the repair operation must be performed after the exception is restarted after the shutdown. 

    Simple to delete and change the search

The installation has been completed successfully here. For a simple mongodb operation.

Enter the Shell interface

Jump to the installation directory of MongoDB after: Enter the MongoDB operation by entering Mongo.

Note : The following code in Red is the part you want to enter:

> Show dbs     -Shows all current databases
Use lydb     --Use the current database without the database: The Create
Show Tables    --Displays all collections (tables) under the current database  if the current library is not specified. is not displayed
Increase
Db.table1.insert ({"Name": "I want to join the party", "Age": "A"}) --Add a document (data row) in the current collection (table) if Table1 does not exist. Create Table1, and add data to table1
Check
db.person.find ()         --Query the collection of all documents in person

Db.person.find ({"Name": "I want to join the party"}) The --find () method can be placed in a condition, and the JSON type lists the results that match the criteria Db.person.find ({"Name": "I want to join the party", "Age": "*"}) --The condition can be multi-conditional, keeping the JSON type.

Db.person.find ({"name": {$regex:/ party. */i}}) --Fuzzy query conditions use regular expressions to complete matching black font as search criteria
Change Db.person.updat e ({"_id": ObjectId ("55F8011E72150D6DDB466D40")},{"name": "Zhaosi", "Age": "+"}) The --update (prom1,prom2) parameters are JSON types, and the properties of PROM1 are the same as in the Find () method: The value of PROM2 will overwrite all document contents found: is covering OH.
Delete Db.person.remove ({"Name": "I want to join the party"})    --The parameter of remove () is the same as find. NULL parameter not supported

MongoDB 3.0.6 installation and additions and modifications

Related Article

Contact Us

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

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.