NOSQL basis

A, mongoDB introduction and use of

  1, the distributed file storage database, developed in C ++, can store any data (files), allowing the server side script that uses data stored as JSON {key: value}

  2, supported programming languages: PHP, ruby, python, C ++, C #, Java, etc.

  3, represents the current database using db

  4, the installation: apt install mongodb / source installation

  5, run: mongo enable the port 27017

  6, management tools: NoSQL Manager for MongoDB, Navicat

Two, MongoDB some of the concepts:

  database database

  Data collection set (Table)

  document file (line)

  field field (column)

  index index

  Does not support table join

  Database ----> collection ----> Documents ----> domain

  MongoDB can have a plurality of databases, different databases can be placed in different files

  System database:

    admin: equivalent to the root database, which is a database of high authority, all of the commands can be executed in the database

    local: a collection of local server storage

    config: related to the fragmentation of the database

Third, the commonly used commands:

  View all databases show dbs

  use admin switch databases

  db current database

  use the database name to create the database

  db.dropDatabase () to delete the database currently in use

  db.createCollection ( 'the collection name') create a collection

  db. collectionname .drop () return value is a Boolean delete collections

  show collections View collections

  db collection name .insert ({key1: value1, key2: value2}). create documents, k1 and k2 are domains, v1 and v2 are values ​​corresponding to the domain

  db.users.find().pretty()   查看users集合下的所有数据

四、数据类型

  布尔

  数字

  字符

  浮点数

  数组

  内嵌文档

  null

  

Guess you like

Origin www.cnblogs.com/yuanshu/p/11769224.html