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

  • 相关阅读:
    luogu P1877 [HAOI2012]音量调节
    luogu P1510 精卫填海
    luogu P1508 Likecloud-吃、吃、吃
    我的VIM
    luogu P1310 表达式的值
    luogu P1402 酒店之王
    luogu P3119 [USACO15JAN]草鉴定Grass Cownoisseur
    luogu P1879 [USACO06NOV]玉米田Corn Fields
    luogu P2746 [USACO5.3]校园网Network of Schools
    [BZOJ4870][六省联考2017]组合数问题(组合数动规)
  • 原文地址:https://www.cnblogs.com/jalenwang/p/3405548.html
Copyright © 2011-2022 走看看