Common API Usage for Java operations mongoDB2.6

Source: Internet
Author: User
Tags bulk insert mongoclient

For MongoDB, there is not much difference between learning style and learning relational database

Start by learning how to insert, find, Update, remove, and then page, sort, index, and then the master-slave copy, copy set, Shard, and so on

The last is to practice the so-called advanced usage through the various drivers it provides (such as Java, PHP, node. js, and so on)


In addition: There are plsql developer,mysql with respect to Oracle Heidisql

MongoDB is no exception, it has a graphical tool called Mongovue, I use the 1.5.3 cracked version (not every 15 days will have to change the type of registry)


The following illustration shows Java as an example of the common operation of MongoDB API usage

Package Com.jadyer.test;import Java.net.unknownhostexception;import Java.util.arraylist;import java.util.List; Import Org.bson.types.objectid;import org.junit.afterclass;import org.junit.beforeclass;import org.junit.Test; Import Com.mongodb.basicdbobject;import com.mongodb.db;import Com.mongodb.dbcollection;import com.mongodb.DBCursor ; Import Com.mongodb.dbobject;import Com.mongodb.mongoclient;import Com.mongodb.writeresult;import com.mongodb.util.json;/** * MongoDB java Driver Test * @see--------------------------------------------------------------- -------------------------* @see Configuration * @see 1) Download https://fastdl.mongodb.org/win32/mongodb-win32-x86_   64-2008plus-2.6.1.zip * @see 2) Unzip to the local hard drive D:\Develop\mongoDB\ and configure the environment variable Path=d:\develop\mongodb\bin * @see Then execute this command under CMD to verify that the installation is successful >mongod--version * @see 3) Create D:\Develop\mongoDBData\ folder for MongoDB data files * @see 4) Custom BAT file, The client to start the MongoDB database and connect to the database respectively * @see start the client's mongo_client.bat content-->mongo 127.0.0.1:27017/admin * @see start the database mongo_db.ba T content is------>mongOD--dbpath D:\Develop\mongoDBData--rest * @see Note: The [--rest] parameter is added to enable access to the MONGODB Web console http://127.0.0.1:28017/* @see---- ------------------------------------------------------------------------------------* @see Java driver * @see The Java driver package for MongoDB is used here, http://docs.mongodb.org/ecosystem/drivers/java/* @see------------------------------------- ---------------------------------------------------* @create May, 10:17:30 PM * @author Xuan Yu 

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.