MongoDB Java driver is thread-safe, for general applications, as long as a MONGO instance, MONGO has a built-in connection pool (pool size defaults to 10).
The following code gives you an introduction to the Java-driven operations of MongoDB, as shown in the following code:
Import java.util.ArrayList;
Import java.util.List;
Import Java.util.regex.Pattern;
Import org.bson.Document;
Import com.mongodb.M
Operation 3: Enable slow query logs for mongodb and mysql, start mongodb from the configuration file, and enable mongodbmysql
1.
Start mongodb from the configuration file
Create a configuration file:/usr/local/mongodb/etc/
, "name": "Zhangsan", "Age": 27}2, BULK INSERT, online documents are said not MongoDB does not support BULK INSERT, now tried can, should be the current version support bulk INSERT.1> Db.student.insert ([{"_id": 2, "name": "Lisi"},{"_id": 3, "name": "Wangwu"}, {"_id": 4, "name": "Zhaoliu", "Age": 28}])2 Bulkwriteresult ({3"Writeerrors" : [ ],4"Writeconcernerrors" : [ ],5"Ninserted": 3,6"Nupserted": 0,7"Nmatched": 0,8"Nmodified": 0,9"Nremoved": 0,Ten"U
MongoDB Introduction
MongoDB is a database based on distributed file storage. Written by the C + + language. Designed to provide scalable, high-performance data storage solutions for WEB applications.
MongoDB is a product between relational database and non relational database, and is the most powerful and relational database in the relational database.
1, mod
" ...}) to add data to a collection in the current database
Db. Collection name. Drop () Delete a collection
Db.dropdatabase () deletes the current database
Now let's use the above command to do a simple example: re-establish a data zyhtest and create a new collection student in Zyhtest and insert the data into the student.
> Use zyhtest
switched to db zyhtest
> Db.student.insert ({"Name": "Zhangsan", "Age":})
Writeresult ({"ninserted": 1})
> Show dbs
0.000GB
zyhtest 0.000GB
> Show Co
Document directory
Original Method
Configuration file Method
Daemon Method
Original Method
The MongoDB function can be used only when the MongoDB service is started. Normally, a command window is opened and the following command is entered to start the service:Configuration file Method
If you do not want to enter a lot of complex parameters in the comm
Label:poiinit_idenablemax offsetsnappysumjpg Data type MongoDB 3.x data capacity gb failure type Server power loss causes WIREDTIGER.WT file corruption Start error detected data files in E:\DTLFolder\MongoDB\dat A created by the ' Wiredtiger ' storage engine, so setting the active storage engine to ' Wiredtiger '. 2018-05-08t16:10:09.755 +0800 I STORAGE [initandl
MongoDB can be run as a network server, and clients can connect to the server and perform operations.1. First, the user must download MongoDB and unzip, run the Mongod command to launch the instance: Http://www.mongodb.org/downloadsConfigure environment variables to facilitate shell command operations later2. Launch an instanceThen we can start the DB instance th
MongoDB Master-Slave synchronization settingsabout MongoDB installation and start-up parameter description can refer to my previous reprint of the "Ubuntu installation MongoDB" and "mongodb St
packages before 2.6 use a different repo location. Refer to the version of the documentation appropriate for your MongoDB version.Run MongoDBThe MongoDB instance stores its data files In/var/lib/mongodb and their log files In/var/log/mongodb by default, and runs Using the MongoDB
How to start and cut MongoDB system logs
When the mongos routing service is enabled during mongodb sharding, a log storage location is specified:1 mongos -- configdb 127.0.0.1: 27019 -- logpath/var/log/mongodb/mongos. log -- pidfilepath/var/run/mongodb/mongos. pid -- logappe
Install and configure MongoDB in Ubuntu 16.04 LTS
MongoDB is a high-performance NoSQL database. Compared with relational databases, it also provides high performance and high flexibility. Here we will explain how to install and configure the MongoDB database on Ubuntu 16.04
Environment, click ctrl + alt + t to open the console, enter the command: sudo passwd root, and press enter to prompt "enter a new unix Password ", enter the password to generate a new root password, and then enter it again. Then enterSuPress enter to enter the password you just set. For example:
Configuration package management system:
1. the Ubuntu package management tool ensures the consistency and reliability of the downloaded package. Run th
Multiverse" | sudo tee/etc/apt/sources.list.d/mongodb-enterprise-2.6.listMongoDB offers 64-bit long-term maintenance version (LTS) Ubuntu packages. For example: 12.04 LTS, 14.04LTS, 16.04LTS. These packages may also work in other versions of Ubuntu, but do not provide help.③ updating the Local installation librarysudo apt-get update④ Installing
MongoDB is a high-performance NoSQL database that offers both high performance and flexibility over relational databases, here's how to install and configure the MongoDB database on Ubuntu 16.04 lts.Add a software source[emailprotected] ~/ $ sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv EA312927[sudo] password for lwk: Executing: /tmp/tmp.Aasd
Try installing MongoDB on Ubuntu. Fortunately, you can use apt-get on Ubuntu. However, it is not the latest version! Sudoapt-getupdatesudoa
Try installing MongoDB on Ubuntu. Fortunately, you can use apt-get on Ubuntu. However, it
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.