Common APIs for Java db2.6 operations

Source: Internet
Author: User

For mongoDB, there are not many ways to learn from relational databases.

At the beginning, we learned how to insert, find, update, and remove, and then paging, sorting, and indexing, followed by master-slave replication, replica set, and sharding.

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


In addition, compared with Oracle, MySQL has PLSQL Developer, and MySQL has HeidiSQL.

MongoDB is no exception. One of its graphical tools is called mongoVUE. I use the 1.5.3 cracked version (not the one that needs to change the registry every 15 days)


The following example shows how to use a common mongoDB API in Java.

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. using client; import com. mongodb. writeResult; import com. mongodb. util. JSON;/*** mongoDB Java driver test * @ see plugin * @ see configuration * @ see 1) download https://fastdl.mongodb.org/win32/mongodb-win32-x86_64-2008plus-2.6.1.zip * @ see 2) unzip to local hard drive D: \ Develop \ mongoDB \, and configure the environment variable path = D: \ Develop \ mongoDB \ bin * @ see and then execute this command under CMD to verify whether the installation is successful> mongod -- version * @ see 3) Create the D: \ Develop \ mongoDBData \ folder, used to store mongoDB data files * @ see 4) custom bat files, which are used to start the mongoDB database and the Client Connecting to the database * @ see mongo_client.bat to start the client. The content is --> mongo 127.0.0.1: 27017/admin * @ see the content of mongo_db.bat starting the database is ------> mongod -- dbpath D: \ Develop \ mongoDBData -- rest * @ see note: the [-- rest] parameter is added to access the mongoDB Web Console http: // 127.0.0.1: 28017/* @ see plugin * @ see Java driver * @ see the mongoDB Java driver package is used here, http://docs.mongodb.org/ecosystem/drivers/java/ * @ see author * @ create May 15,201 4 10:17:30 * @ 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.