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 (转载请注明出处)

  • 相关阅读:
    信号
    13. 罗马数字转整数
    ES6基础-constructor与super
    关于antd-vue动态表单的问题以及解决方案
    (vue)关于在ui框架方法中传入多个参数的解决方案
    ts-4: 类型别名与interface
    ts-3:元组与类型约束
    TS-2:类型注释与类型推断、函数参数的定义与返回类型的定义、对象成员与数组成员的定义方法、类型别名与类别名
    LeetCode 141. 环形链表 | Python
    LeetCode 459. 重复的子字符串 | Python
  • 原文地址:https://www.cnblogs.com/jalenwang/p/3405548.html
Copyright © 2011-2022 走看看