Implementation tutorial of MongoDB set field matching query method, mongodb Field
MongoDB is a distributed file storage-based database. This article describes how to perform matching queries on the fields integrated in MongoDB records.1. Create a Test Database
use testdbdb.
. Minimize cross fragment query, balance balance number is less.
10. Query only the fields you want to use without querying all the fields.
11. When updating the value of a field, using $inc is more efficient than update.
12.apped collections is more efficient in reading and writing than ordinary collections.
13.server-side processing a stored procedure similar to a SQL
Similar to hibernaterepository, by inheriting the mongorepository interface, we can easily add, delete, modify, and query an object. To use the repository function, we must first inherit the mongorepository
Example:
Public interface personrepository extends mongorepository
However, mongorepository only implements the most basic addition, deletion, modification, and query functions. To add additional
-- ===========================--MongoDB Slow query log-- ===========================
reference:http://docs.mongodb.org/manual/tutorial/manage-the-database-profiler/
Profiling levels:1 Resume0-the Profiler is off, does does not collect any data.1-collects profiling data for slow operations only. By default slow operations are those slower than.You can modify the ' threshold for ' slow ' operations with the S
case used in this article. I imported the following entity data into the database. In this case, cus_id and amount are generated into an ordered number, and the number of records imported is 200 w:
Public class Test {// For the following operations based on the MongoDB GUI tool, see references 3.
First, let's take a look at the parameters and results required for paging. The common parameters required for
Related information 1. MongoDBforJava driver package github. commongodbmongo-java-driverdownloads2, online documentation www. mongodb. orgdisplayDOCSJava + Language + Center operation 1. query all data in a table (called a set in MongoDB) using the Java code DBTest. javapack
Related information 1, MongoDB for Java driv
Related reading:
Install and start MongoDB in Linux
Advanced query example in MongoDB
MongoDB Java API for insert and single collection basic query examples
Query operations under MongoDB
1, SortNeedless to say, MongoDB also support to sort data. The positive one means sorting by ASC order and negetive means by Desc.2. GroupThe Grammar of group:Description of Argument:key:the Field need to groupCond:query conditionInitial:initialize the counter of groupredue:generally statistic operationFinalize:further operation after group, for Exampe calcuate the average.3.3. DistinctIt ' s the same as the distinct in the relational database.4. Page
version, but also for the statistics of the data brought convenience.
3. MongoDB loads the data in the database into memory as a file map after it is started. If the memory resources are quite rich, this will greatly improve the query speed of the database, after all, memory I/O efficiency is much higher than disk.
However, as a fresh transaction,
Mongodb query, mongodb1. query a single record
> db.choice.findOne()
2. Specify query conditions during Query
> db.choice.find({"_id":"005a38d5"})
All queries by default {}
Return Column
> db.choice.find({"_id":"005a38d5"},{"title":1,"results":1}){ "_id" : "005a38d5", "
cursor.nocursortimeout () method: var mycursor = Db.users.find (). Nocursortimeout (); After setting the nocursortimeout option, you must either close the cursor manually with cursor.close () or by exhausting the cursor ' s results. See your driver documentation for information on setting the nocursortimeout option.Cursor IsolationAs a cursor returns documents, other operations could interleave with the query. For the MMAPV1 storage engine, interveni
This is a creation in
Article, where the information may have evolved or changed.
More Articles
Quick Smart Programmer Community
Front-end input query criteria, background based on query criteria, query MongoDB, filtered results are displayed again.
Front page:
Query condi
Tags: mongodb skip limit sortMongoDB uses cursors to process the set of result documents found by the Find query;Examples of use of cursors:>varcursor=db.post.find ({"Name.firstname": "Joe"}) >cursor { "_id" :objectid ("54ace1394ba07ed75df68f90"), "name" :{ " FirstName ":" Joe "," LastName ":" Schome "}," Age "NBSP;:NBSP;28NBSP;} { "_id" :objectid ("54ace753eab1d0ba4abb48ab"), "name" NBSP;: { "FirstName" :
Tags: mongodbIn the last blog, we talked about the basic operation of MongoDB, including insert, query, remove and update. Now on this blog, we'll further hava a good understanding of querying operation.At first, let's create the recors for testing. As the following picture depicts.Condition Expression1. 2. $allThis operation was analogous to the $in operation. But the difference is, $all operation requires
Tags: version ext orm DStar Mongovue mit. NET Rtti term the data structure to query for such as the following: take the Versionlimitlist field in the query as an example Mongooperations Tool class Query related statements the query validstarttime is greater than the cur
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$", pa
The data structure to query is as follows:As an example of querying the Versionlimitlist fieldMongooperations Tool class Query related statementsEnquiry validstarttime is greater than the current time, and the clientId in the Versionlimitlist field The property value is 109 and the Platformcode property value is 2 Statements in the Mongovue{" validstarttime
How to use php to perform a fuzzy query on mongodb (the query conditions include Chinese characters )? Mongodb has two data records: { quot; bc quot;: quot; 012345678 quot;, quot; name quot;: quot; vida paper towel flower rhyme quot;, quot; cls quot;: how to use php to perform fuzzy
and import tools Mongofiles:gridfs management tools enable access to two files MONGOs: Fragmented routing If the sharding feature is used, then the application connects to the MONGOs instead of the Mongod Mongosniff: The tool works like the tcpdump, except that he only monitors MONGODB-related packet requests and outputs them in the specified readability form Mongostat: Real-time performance monitoring too
cursor = Collection.find (queryobject);while (Cursor.hasnext ()) {DBObject obj = Cursor.next ();System.out.println (Obj.tostring ());}Note:$GT:>$gte: >=$eq: =$ne:! =$LT: $lte: $in: In (The following value is an array of Bson objects)$nin: Not in (the following value is an array of Bson objects)The use of these operators is similar to $GT, not repeatingSummarizeThrough this article can be a simple query MongoDB
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.