zoukankan      html  css  js  c++  java
  • basic mongodb

    basic mongodb

    basic mongodb

    Components

    mongod

    mongod is the primary daemon process for the MongoDB system. It handles data requests, manages data format, and performs background management operations.

    --dbpath <path> Specify a directory for the mongod instance to store its data. Typical locations include: /srv/mongodb, /var/lib/mongodb or /opt/mongodb

    Unless specified, mongod will look for data files in the default /data/db directory. (Windows systems use the datadb direc‐ tory.) If you installed using a package management system. Check the /etc/mongodb.conf file provided by your packages to see the configuration of the dbpath.

    --directoryperdb Alters the storage pattern of the data directory to store each database's files in a distinct folder. This option will create directories within the --dbpath named for each directory.

    Use this option in conjunction with your file system and device configuration so that MongoDB will store data on a number of distinct disk devices to increase write throughput or disk capacity.

    mongo

    http://docs.mongodb.org/manual/tutorial/getting-started/

    mongo
    

    By default, mongo looks for a database server listening on port 27017 on the localhost interface. To connect to a server on a different port or interface, use the --port and --host options.

    Select a database

    db
    
    show dbs
    
    use mydb
    
    

    Create a Collection and Insert Documents

    j = { name : "mongo" }
    k = { x : 3 }
    
    db.testData.insert( j )
    db.testData.insert( k )
    
    show collections
    
    db.testData.find()
    

    Post by: Jalen Wang (转载请注明出处)

  • 相关阅读:
    作业 20180918-2 每周例行报告
    将Python文件打包为exe文件,并在控制台运行之简易教程
    作业20181011-1 每周例行报告
    用WebView加载本地图片的方法
    ios webview自适应实际内容高度4种方法
    UIWebView加载本地网页与图片的方法
    nonatomic与atomic的区别与作用
    @dynamic与@synthesize的区别与用法
    xib与storyboard的区别
    iOS与H5的交互
  • 原文地址:https://www.cnblogs.com/jalenwang/p/3405548.html
Copyright © 2011-2022 走看看