collection does not exist) and the datadb. Collection name. Drop () Delete collectiondb.getcollection ("collection name") gets the information for a collectiondb.getcollectionnames () gets all the collections under the current databasedb.printcollectionstats () gets the state of all the collections under the current database
crud of DataInsert: db. Collection name. Insert ({"name": "Test", "Age":), note that only one of the JSON arrays inserted, "{}", of course, can contain sub-data, but
of values, or a data or a pair of key-value pairsExample: Db.mytest.insert ({age:1,name: ' name1 ', map:[2,2]})Db.mytest.insert ({age:2,name: ' name2 ', map:[2,3]})....Db.mytest.insert ({age:5,name: ' Name5 ', map:[5,6]})Add more than one piece of dataTo create a geospatial index:Example: Db.mytest.ensureIndex ({"Map": "2d"})7. Geo-Spatial index query: use $nearFind two closest points from [5,5]: Example: Db.mytest.find ({map:{"$near": [5,5]}}). Limit (2)8. Follow the graph to find: square {"$w
s:colls) {System.out.println (s);}Get testcollection TableDbcollection coll = db.getcollection ("testcollection");New A Basicdbobject object docBasicdbobject doc = new Basicdbobject ();Assign valueDoc.put ("name", "MongoDB");Doc.put ("type", "database");Doc.put ("Count", 1);Another new one Basicdbobject object infoBasicdbobject info = new Basicdbobject ();Info.put ("x", 203);Info.put ("Y", 102);Put info into docDoc.put ("info", info);Insert a piece o
of the collectionDb.drop.Database (); Deleting a databaseDb.help () See Help informationvar x=db.user.find ();X.next ();X.next (); A one-way cursor in a recordX.hasnext ();Db.collection.update (Criteria,objnew,upsert,multi)Criteria: The object used to set the query criteriaObjnew object for setting updated contentUpsert: If the record already exists, update it, otherwise add a record, the value is 0 or 1 1 already exists update 0 newMulti: If there are multiple records that match the criteria,
[Sorting] Summary of common MongoDB commands
Summary of common MongoDB commands
Simple addition, deletion, modification, and query dataSpecify whether to display or not to display a field in the query result.
For example, we want to search for all the data in the lessons collection, but do not want to include th
Tags: mongodbThree ways to build a http://blog.csdn.net/luonanqin/article/details/8497860 MongoDB clusterNoSQL = Not the only SQL MongoDB storage method is document-type storage, not key-value form.MongoDB three ways to build a cluster: Replica set/sharding/master-slaverReplica set replica set cluster principle: (The simplest way to cluster)Master node, standby node, quorum node. The primary and standby nod
Common commands for creating, updating, and deleting MongoDb documentsMongodb is written by C ++. Its name comes from the middle part of the word humongous. From its name, we can see that its ambition lies in the processing of massive data. The simplest description of this database is scalable, high-performance, open source, schema-free, and document-oriented database. MongoDB's main goal is to build a brid
");
Comparison between mongodb and mysql commands
Traditional relational databases are generally composed of three levels: database, table, and record. MongoDB is composed of databases and collections) and document objects. MongoDB has no concept of columns, rows, and links for tables in relational databases, which
// 启动服务> net start MongoDBState Monitoring Static statisticsDb.stats ()// 查看单个数据库状态> db.stats()statsRelatively simple, you can refer to the db.stats () articleDb.serverstatus ()// 查看整个mongodb的状态// 进入admin集合> mongo 127.0.0.1:2222/admin// 查看状态> db.serverStatus()serverStatusA lot of parameters, you can refer to the Db.serverstatus () articleReal-time statistics> mongostat --port 2222Security CertificationsTodoA little complicated, lazy, reference safety
is another way to handle aggregation calculations; Map-reduce typically has two stages: one stage is to process a single document, and the other is to return one or more objects to the next document processing method;
The amount of ..... Well, in short, it's the reduce document result set, summarized by the reduce function;
Reduce don't need me to explain it.
Map-reduce uses idiomatic JavaScript operations for map and reduce operations, so map-reduce flexibility and complexity can be higher tha
MongoDB has been used recently in new projects, so it took some time to learn a bit. This article to their own study to make a summary, intends to use this article as an API in the future, but also to some ready to learn the small partners, hoping to help you.Date:2018-04-25 20:49:12MongoDB Common Commands
MongoDB has been used recently in new projects, so it too
As the company also has several MongoDB database, need to open a certain portion of the permission for external personnel to use, so here to record, only for the needs of friends to use.1. MongoDB Common Commands[[Emailprotected]~]#ps-ef|grepmongod[[emailprotected]~]#mongo --host=127.0.0.1--port=27017MongoDBshellversion:3.2.7connectingto: 127.0.0.1:27017/test>sho
Tags: mongod class upd ups tables Understand log CREATE DATABASE fieldHere's a record of what MongoDB often commands Database relatedCreate a database Use database_name If the database does not exist, create the database, or switch to the specified database. Delete database : Switch to the database you want to delete, execute the command. Db.dropdatabase () View all databases Show DBS Collection relatedVi
command to start the database
1
mongod --dbpath C:\MongoDb\data\db -logpath C:\MongoDB\data\log\mongolog.log
Common commands for several databases
use DATABASE_NAME // 创建数据库
>db // 检查当前的数据库
mydb
>show dbs // 查询数据库列表
local 0.78125GB
test 0.
Tags: alt server connect str file--Success Path definition1. Installation Download and install, note the installation method is custom, path customization (D:\CHENGXU\MONGODB), after the installation is successful and then the new Data folder (within the new DB folder) and Logs folder (inside new Mongodb.log file) under the MongoDB folder 2. Server-side Connection CMD window, enter "d:\chengxu\
Tags: Mon Common operations drop restore Comm Ash data MONGO endView all databases: > Show DBS;
Select a database: > Use ECommerce;
To view the current database status: > Db.stats ();
To view all the collections in the current database: > Show Collections;
To view the collection status: > DB. Toperatelog.stats (1024)
To view collection data: > DB. Toperatelog.find ()
To delete a data collection: > DB. Toperatelog.drop ()
To back up a database collection: #/usr/local/
Label:The project used to MongoDB, the basic is to use Robomongo to connect the server, do some of the lower permissions to delete and change the operation. Commands often forget to record some of the most frequently used commands for collections for easy querying: 1 , create a clustered collection (table)
- 5 - });
2 a Clustered collection (table) with th
After the successful start of MongoDB, and then open a command line window input MONGO, you can do some of the database operations.1. Enter Help to see the basic Operation command:Show DBS: Display database list Show Collections: Displays a collection in the current database (similar to a table in a relational database) show Users: Show user use ;: Toggles the current database, which and ms- 1}): Find the Foo collection in the current database, provi
Tags: style blog http os using IO ar for dataI am a mongodb installed in CentOS1. Download MongoDBCurl-o http://downloads.mongodb.org/linux/mongodb-linux-x86_64-2.6.3.tgz2. Unzip the downloaded documentTAR-ZXVF mongodb-linux-x86_64-2.6.3.tgz3. Installing MongoDBCp-r mongodb-linux-x86_64-2.6.3/*/usr/local/mongoStart Mon
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.