Manage MongoDB databases with MongoVue

Manage MongoDB databases with MongoVue

Today, I saw a very good MongoDB client tool MongoVue at my colleague, the address is http://www.mongovue.com/. Well done, version 1.0 started to charge, and the fee is not expensive at only 35$. Students who really need it can spend some money to buy one, which can be regarded as supporting this tool. If it is only for study and research, I have a version 0.9.7 here. Although there are some bugs compared to version 1.0, it is enough for normal use. Students who need it can contact me individually. Functionality is limited after 15 days after version 1.0. The restriction can be lifted by deleting the following registry key: [HKEY_CURRENT_USER\Software\Classes\CLSID\{B1159E65-821C3-21C5-CE21-34A484D54444}\4FF78130] Just delete all the values ​​under this item. The above picture below shows you the powerful MongoVue, which can improve your happiness index of using MongoDB by dozens of points. The picture above is king: 1. Configure connection 2. Try creating a new Collection named AccessLog: 3. Insert a Document 4. View the data we inserted, the data can be displayed in a variety of ways (tree, table, text) Above we all operate through the graphical interface. There is a window below that lists the client commands for the…

Introduction to the use of MongoDB client MongoVUE

Introduction to the use of MongoDB client MongoVUE

1) Download URL http://www.mongovue.com/downloads/ 2) Install Windows platform installation method (requires at least Microsoft .NET Framework installed in the window system 3.5) 3) Use MongoVUE client to connect to mongodb MongoVUE 1.5.3 How to reset the 13-day trial period infinitely MongoVUE reads the following registry keys at startup: [HKEY_CURRENT_USER\Software\Classes\CLSID\{B1159E65-821C3-21C5-CE21-34A484D54444}\4FF78130] Just delete all the values ​​under this item.

Introduction to the use of Java client of MongoDB database

1. Download the mongoDB jar package and import it into the CLASSPATH of the project 2. Link to the mongoDB server and select the database To establish a MongoDB connection, you simply specify the database you want to connect to. This database does not necessarily exist. If it does not exist, MongoDB will first create this database for you. At the same time, you can also specify the network address and port to connect to when connecting: Mongo m = new Mongo(); // or Mongo m = new Mongo( “localhost” ); // or Mongo m = new Mongo( “localhost”, 27017 ); // or, to connect to a replica set, supply a seed list of members Mongo m = new Mongo(Arrays.asList(new ServerAddress(“localhost”, 27017), New ServerAddress(“localhost”, 27018), New ServerAddress(“localhost”, 27019))); DB db = m.getDB( “mydb” ); 3. Security verification (optional) boolean auth = db.authenticate(userName, password); 4. Get the collection list. Each database has zero or more collections, and you can get a list of them when needed: Set colls = db. getCollectionNames(); for (String s : colls) { System. out. println(s); } 5. Get a set. To get a specific collection, you can specify the name of the collection and use the…

Encapsulation class for Java to operate MongoDB database

MongoDB Java Common Method recently wrote a public class for some common operations of MongoDB, hoping to help beginners. package model.dao; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import org.bson.types.ObjectId; import com.mongodb.BasicDBObject; import com.mongodb.DB; import com.mongodb.DBCollection; import com.mongodb.DBCursor; import com.mongodb.DBObject; import com.mongodb.Mongo; import com.mongodb.MongoException; /** * MongoDB Manager * @author Ken Chau * */ public class MongoDBManager { private static Logger log = Logger.getLogger(MongoDBManager.class); private static Mongo mg = null; private static DB db = null; private final static MongoDBManager instance = new MongoDBManager(); /** * instantiation * @return * @throws Exception */ public static MongoDBManager getInstance() throws Exception { return instance; } static { try { mg = new Mongo(HOST, PORT); db=mg.getDB(DB); } catch (Exception e) { log.error(“Can’t connect MongoDB!”); e.printStackTrace(); } } /** * Get collection (table) * @param collection */ public static DBCollection getCollection(String collection) { Return db.getCollection(collection); } /** * ———————————-Dividing line————- ————————- */ /** * Insert * @param collection * @param map */ public void insert(String collection, Map map) { try { DBObject dbObject = map2Obj(map); GetCollection(collection).insert(dbObject); } catch (MongoException e) {       log.error(“MongoException:” + e.getMessage()); } } /** * Batch Insert * @param collection * @param list */ public void insertBatch(String…

Client programming of MongoDB database

After researching for a long time, I can finally connect to the mongodb server in windows vs2008 through C++ coding, so as to perform other database access operations. 1. The reason for spending so much time is that I didn’t understand these things at the beginning scons, python, SpiderMonkey, The relationship between boost and mongodb, write down your personal understanding below. To code the mongodb client under windows, you need to compile and generate a mongoclient.lib, which is the C++ interface class library required to connect to the mongodb server. 1. scons scons is an automated build tool written in Python, which is similar to the make tool of linux. The associated SConstruct file is also a makefile file similar to the make tool, Describes what and how to compile and link. Here is to use the scons tool to compile and generate mongoclient.lib (instead of vs). 2.python Python is an object-oriented, literal computer programming language. Because scons is written in python, its library must be used, so install python before scons. 3. SpiderMonkey A Javascript scripting engine implemented in C language, the data type format of mongodb is bson, and bson is the binary storage format of json, json…

How Linux compiles the c++ client of MongoDB database

Preparation before installation: 1/ Install the boost library 2/ Install the scons program Method 1: $ git clone git://github.com/mongodb/mongo.git $ cd mongo $ cat docs/building.md $ scons . After a period of compilation, the server and client of mongodb, as well as the c++ client library can be generated. Method 2: Use scons to compile (the scons program must be installed first) Download the mongo source code from the official website (http://www.mongodb.org/downloads), the version I downloaded is mongodb-src-r2.0.7.tar.gz After decompression, generate mongodb-src-r2.0.7 directory, cd to this directory Then execute the command: scons –prefix=/urs/local/mongo At that time, three directories bin, include, lib will be generated in /urs/local/mongo in: The bin contains the server and client of mongo, and some other tools include is the header file of mongo lib is the client library, the cpp client library generated here Finish! In the source code directory, there are some simple test samples under client/example, which can be compiled: cd to client/example compile first.cpp g++ first.cpp -o first -I/usr/local/mongo/include/mongo -L/usr/local/mongo/lib -llibmongoclient.a -lboost_thread -lboost_filesystem -lboost_program_options -lboost_system Compile clientTest.cpp g++ clientTest.cpp -o clientTest -I/usr/local/mongo/include/mongo -L/usr/local/mongo/lib -llibmongoclient.a -lboost_thread -lboost_filesystem -lboost_program_options -lboost_system Note: Be careful about the linking order of the libraries in the compilation command, it…

Use spring to manage MongoDB database

Install Spring for Mongodb In order to facilitate the operation of Mongodb, the Spring project has established a sub-project of spring-data, the address is: http://www.springsource.org/spring-data/mongodb, the current version is in the 1.0.0M2 stage, and already supports a series of basic operations on Mongodb. We first download the relevant package from http://www.springsource.org/spring-data/mongodb: spring-data-document-1.0.0.M2.zip, after downloading and decompressing, put The four decompressed JAR files are placed in the lib library of the project path, and Spring will also be used in this article Version 3.0.4, please download the configuration by yourself. Configuration of Spring Mongodb Currently, there are two ways to configure Spring mongodb. The first is to use Spring 3, the other is to use traditional XML configuration. The following are the explanations: Using annotations in Spring 3 First, in the configuration class, inherit the AbstractMongoConfiguration class, packagecom.mkyong.config; importorg.springframework.context.annotation.Bean; importorg.springframework.context.annotation.Configuration; importorg.springframework.data.document.mongodb.MongoTemplate; importorg.springframework.data.document.mongodb.config.AbstractMongoConfiguration; importcom.mongodb.Mongo; /** * Spring MongoDB configuration file * */ @Configuration publicclassSpringMongoConfig extendsAbstractMongoConfiguration { @Override public@Bean Mongo mongo() throwsException { return newMongo(“localhost”); } @Override public@Bean MongoTemplate mongoTemplate() throwsException { return newMongoTemplate(mongo(),”yourdb”,”yourCollection”); } } Here, the MongoTemplate template class is introduced, and the address to connect to the database, database name and collection are initialized. In calling Spring When configuring Mongodb,…

MongoDB cluster configuration learning

MongoDB cluster configuration learning

1. Master-slave replication of mongodb: Main server: mongod –dbpath “F:\mongodb\data” –port 27017 From the server: mongod –slave –dbpath “F:\mongodb-slave\data” –port 10001 –source localhost:27017 –only test Option Description: –only Specify to copy a database on the slave node (by default, all databases are copied) –slavedelay Used on slave nodes to add delay (seconds) when applying master node operations –fastsync Start the slave node based on the data snapshot of the master node. If the data directory is initially a data snapshot of the master node, starting the slave node with this option is much faster than a full synchronization. –autoresync Automatically resyncs if the slave gets out of sync with the master –oplogSize The size of the primary node oplog (MB) Generally, there are no more than 12 slave nodes in a master-slave service group, so as to avoid thousands of slave nodes from initiating queries on a single master node and dragging down the master node 2. Replica set of mongodb: A replica set is a master-slave cluster with automatic failure recovery. The most obvious difference between a master-slave cluster and a replica set is that the replica set does not have a fixed master node. The replica set can…

How to deploy a highly available MongoDB cluster

How to deploy a highly available MongoDB cluster

In the era of big data, traditional relational databases must solve the problems of high concurrent reading and writing, efficient storage of massive data, high scalability and high availability in order to provide higher services. But it is because of these problems that Nosql was born. NOSQL has these advantages: Large data volume, you can store a large amount of data through cheap servers, and easily get rid of the traditional mysql single-table storage level limit. High scalability, Nosql removes the relational features of relational databases, it is easy to expand horizontally, and gets rid of the criticism of vertical expansion in the past. High performance, Nosql obtains data through a simple key-value method, which is very fast. In addition, NoSQL’s Cache is record-level, which is a fine-grained Cache, so NoSQL has much higher performance at this level. Flexible data model, NoSQL does not need to create fields for the data to be stored in advance, and can store custom data formats at any time. In a relational database, adding and deleting fields is a very troublesome thing. If it is a table with a very large amount of data, adding fields is simply a nightmare. High availability, NoSQL can…

Comparison of MongoDB commands and SQL statement syntax

Comparison of mongodb and mysql commands Traditional relational databases are generally composed of three levels of concepts: database, table, and record. MongoDB is composed of database, collection, and document Composed of three levels. For tables in relational databases, MongoDB does not have the concept of columns, rows, and relationships in the collection, which reflects the characteristics of free schema. MySQL MongoDB Description mysqld mongod server daemon mysql mongo client tool mysqldump mongodump Logical Backup Tool mysql mongorestore Logic Recovery Tool db. repairDatabase() repair database mysqldump mongoexport Data Export Tool source mongo import data import tool grant * privileges>Db. addUser() Db.auth() Create a new user and permissions show databases show dbs show library list Show tables Show collections show table list Show slave status Rs.status Query master-slave status Create table users(a int, b int) db.createCollection(“mycoll”, {capped:true, size:100000}) Another: tables can be created implicitly. create table Create INDEX idxname>db.users.ensureIndex({name:1}) create index Create INDEX idxname>db.users.ensureIndex({name:1,ts:-1}) create index Insert into users values(1, 1) db. users. insert({a:1, b:1}) insert record Select a, b from users db.users.find({},{a:1,b:1}) query form Select * from users db. users. find() query form Select * from users where age=33 db.users.find({age:33}) conditional query Select a, b from users where age=33 db.users.find({age:33},{a:1,b:1}) conditional…

Contact Us

Contact us

181-3619-1160

Online consultation: QQ交谈

E-mail: [email protected]

Working hours: Monday to Friday, 9:00-17:30, holidays off

Follow wechat
Scan wechat and follow us

Scan wechat and follow us

Follow Weibo
Back to top
首页
微信
电话
搜索