The Java driver I used was version 2.13
Driven by: http://mongodb.github.io/mongo-java-driver/
The corresponding API address is: http://api.mongodb.org/java/2.13/
Design of MongoDB Database interface
Packagestorm.db;Importjava.util.ArrayList;ImportCom.mongodb.DB;Importcom.mongodb.DBCollec
= % JAVA_OPTS %-server-XX: PermSize = 128 m-XX: MaxPermSize = 512 m.
After this method is tried, the exception persists. After the PermSize is changed, restart tomcat and the exception persists.
Method 2: orModify the catalina. sh/bat file:
rem catalina.bat
set JAVA_OPTS=-Xms64m -Xmx256m -XX:PermSize=128m -XX:MaxNewSize=256M -XX:MaxPermSize=256m
#catalina.shJAVA_OPTS=-Xms64m-Xmx256m-XX:PermSize=128m-XX:MaxNewSize=256m-XX:MaxPerSize=256m
Failed to restart tomcat
Method 3:Add the following at the
This example for you to share the Java Operation MongoDB Fuzzy query and paging query for your reference, the specific contents are as follows
Fuzzy query conditions:1. Perfect MatchPattern pattern = pattern.compile ("^name$", pattern.case_insensitive);2, right matchingPattern pattern = pattern.compile ("^.*name$", pattern.case_insensitive);3, left matchPattern
) {System.out.println (_doc.tojson ());}});Greater than or equal to->=Use the same as above, the symbol is $GTELess than-finditerableor finditerableIter1.foreach (New blockpublic void Apply (Document _doc) {System.out.println (_doc.tojson ());}});Less than or equal to-Use the same as above, the symbol is $lteand-andfinditerableor finditerableIter1.foreach (New blockpublic void Apply (Document _doc) {System.out.println (_doc.tojson ());}});or-or.listList.add (New Document ("name", "Zhang San"));L
stages in the use of time. One is the translation stage, the other is the comparative stage. For example, I passed the parameter 2016-08-12 10:31:20, this time does not specify the timezone, if I want to express the Beijing time, then the corresponding is UTC 2:31:20. There's a problem here. MongoDB time is UTC time, I want to query the data before 10 point 31, and then I use the new date to specify the ti
Tags: pre on () rank compile double ASE ITER PAT supportMongoDB is a NoSQL database that stores something like a JSON object that supports some operations similar to a relational database. Here is the Java operation MongoDB. First, establish a connection (without using any framework, the connection is written by itself, while in this class write the method of closing the connection), the incoming IP address
Due to business needs, the company recently transferred part of the data to the MongoDB database.
After deploying the MongoDB database with the corporate DBA, we started our Java Connection MongoDB practice
Before you start, recommend two IDE tools to connect to your database
1.rockmongo-on-windows-v0.0.2 (only run su
PackageCom.xinsight.server;Importjava.net.UnknownHostException;ImportJava.util.HashMap;ImportCom.mongodb.BasicDBObject;ImportCom.mongodb.DB;Importcom.mongodb.DBCollection;ImportCom.mongodb.DBCursor;ImportCom.mongodb.Mongo;/*** Find all data in a column in MongoDB that contains a map collection*/ Public classFindmongodbmap {Private StaticMongo mg; Private StaticDB DB; Private Static intnum = 0; Public Stati
for execution tools. The javac and javadoc tools that process source code use the initial class path instead of the expanded class path (for more information, see how to find classes in the following Javac and Javadoc ).
How to find extension classes in Java starters
An extension class is a class that extends the Java
This article mainly introduces the MongoDB corresponding Java commonly used to delete and change the API, as well as and spring integration after mongotemplate common methods used, nonsense not much said, directly on the code:
1. First of all, the two entity classes that need to be used are user and home, corresponding users and native
Import java.util.List;Import org.springframework.data.mongodb.core.mappi
Label:Group grouping statistics is a common function of database, MongoDB is no exception. However, relative to the normal additions and deletions, the group operation is a little more trouble, here to the group in the shell operation, the use of Java native Code operation and integration of spring operation to a simple summary, the grouping of ways and methods should have a variety of, here each one only t
that it can naturally write parallel programs.
I partially agree that Joshua Bloch emphasizes that the introduction of closures in Java requires another thought (the approach proposed by bgga is really bad), at least the lack of closures, this makes it impossible to do any real functional programming in Java.2. The first-class function is missing:
This problem is related to the previous one, but I think it
See a lot of people search Java and MongoDB, then write point Java Operation MongoDB Project experience. MongoDB Java-driven basic operations can be seen here.
In fact, the MongoDB
1. Download the MongoDB jar package and introduce it to the classpath of the project: mongodb2.5 driver package DownloadIf you use a MAVEN project, the latest dependencies are as follows:Dependency> groupId>Org.mongodbgroupId> Artifactid>Mongodb-driverArtifactid> version>3.2.0version>Dependency>It is important to note that if the project is not a MAVEN project but by introducing a jar package, then th
Web service interface directly, as shown in routine 4. Routine 4 calls Web Service 2 via Jndi
Context ic= new InitialContext ();
Helloserviceinterface Service =
(helloserviceinterface) Ic.lookup
("Java:comp/env/service/helloservice");
As you can see in the following example, this method simplifies the call in a single step. Here's an example that demonstrates how to reference a Web service on the client si
, I use the Microsoft-provided process Explorer v15.3Http://technet.microsoft.com/en-us/sysinternals/bb896653.aspxUnzip run after downloadRight-click the process you want to see---properties4. Then select the Threads tab to find the TID for the CPU-consuming thread, for example, I'm a 31876 thread here.5. Convert the PID into 16, I am here directly with the system of the calculator conversion, placed on why
conditions, record is updated records, can not contain _id in the record ...3. Delete operation: Public Static synchronized intdel (dbobject record, olacloudcontent olacloudcontent) {dbcollection col=mongodb.getdbcollection (table_name); //Check if there is a corresponding obj_id presenceDbcursor DC =Col.find (record); if(Dc.count () ) { returnno_record_exist; }//Delete DataWriteresult result =Col.remove (record); Oplog.addoplog (Olacloudcontent.getusername (), TABLE_NAME,"Del_key",
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.