Mongodb Study Notes 01 and mongodb Study Notes

Source: Internet
Author: User
Tags import database

Mongodb Study Notes 01 and mongodb Study Notes
Mongodb Overview

Mongodb is a document-type NoSQL database that stores bson-> json binary. The internal execution engine is a js interpreter that stores documents into a bson structure and converts them to js objects during query. And can be operated through js syntax.

Comparison between mongodb and traditional databases

Traditional DatabasesIs a structured database with the same number of Columns

Document DatabaseIn document units
For example:

{    id:1,    name: "billvsme",    age:21,}
{    id:2,    name: "zhangshan",    phone:12313,    address:23424,}

Can all exist under a table

Document DatabaseThe biggest feature is "no structure". Each document in the table can have its own unique attributes and values.

Column: Comment reply, score, at least multiple tables in the traditional database, the Association is complex, and a document in the document database can be completed

{Title: 'xxxx' comment: [{connent: 'You wrote well !!! ', Reply: ['comments are good', 'Write is good ']}, {connent:' not good at writing ~~ ', Reply: ['approval', 'strongly approval']}
Mongodb Installation

Download the package directly and decompress it to run it.
Https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-3.0.4.tgz

Mongodb running mongodb file structure
  • Bsondump binary Export
  • Mongo client (equivalent to mysql)
  • Mongod server (equivalent to mysqld)
  • Mongodump overall Database Export
  • Mongoexport export is easy to recognize json or csv documents
  • Mongorestore import database
  • Mongos router (used for sharding)
Start mongod
mongod --dbpath /path/to/database --logpath  /path/to/logfile --fork  --port 27017
  • -Dbpath: database storage path
  • -Logpath: Log File Path
  • -Port: 27017 by default
  • -Fork background running
Test

Enter./mongo directly to mongo.

  • Show dbs
  • Use database to enter the database
  • Show tables/collections View table
  • Db. help () help

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.