to be done by ourselves in the program. The result set of the query is filtered in the Java query as needed.7. Other operationspublic void Testothers () { DBObject user = new Basicdbobject (); User.put ("name", "Hoojo"); User.put ("Age", 24); JSON Object Transformation Print ("Serialize:" + json.serialize (user)); Deserialization
mongodb port is 27017. Enter http: // localhost: 27017/in the browser, for example:
Change the port to 28017 to view more mongodb Management Information: http: // localhost: 28017/For example:
III. Basic operations
As it is an entry point, let's just talk about the addition, deletion, modification, and query of mongodb
Tags: mongodb nosqlFirst, Introduction Our last article introduced Db.collection.find () can be implemented based on conditional queries and specifying fields returned using the projection operator omit this parameter to return all fields in the matching document, we present today the query operations for array and inline documents, especially for the $ Elemmatch can also use the second parameter of the Fin
Find () methodTo query the collection data from MongoDB, you need to use the MongoDB find () method.GrammarThe basic find () method syntax is as follows>db. Collection_name. Find() The Find () method displays all the files in an unstructured manner.Pretty () methodThe results are displayed in a formatted manner and can be used with the pretty () method.Gram
(1) $all query: Used to query an array, match elements in an array, to match all to have results: example:Now if I write this way: Db.customer.find ({"Books": {"$all": ["Java", "JQuery"]}}), then the result is not found, becausein document no results are matched, only the ["Java", "JQuery"] are matched in the document
MongoDB collection document creation, modification, deletion, and query command summary, mongodb modification and Deletion
Install mongodb in windows. Start it. Previous Article: mongoDB Installation Details
1. log on to view the collection documents in the database to add,
MongoDB query, index and aggregation, MongoDB, and index aggregation
Initialize the mongodb Database
> Use dengswitched to db deng> db. createCollection ("jingdong") # No parameter {"OK": 1}> show collectionsjingdongsystem. indexes> userdoc1 = ({"user_id": 1, "name": "cloud", "state": "active", "actor": "user ", "e-mai
The Find () function in the MongoDB returns a cursor that enables the client to effectively control the query results by setting some settings on the cursor, such as restricting the number of results obtained by the query, skipping partial results, or pressing any key to the result set. We used to operate in the shell, using the Find () function directly, withou
Detailed examples of PHP operations on MongoDB databases (add, delete, modify, and query) (6). mongodb DatabasePHP operations on mongodb:Modules are required for PHP to operate mongodb.Official website can download: http://pecl.php.net/package/mongo downloadSet mongodb to user-authorized Startup ModeThe php Manual does
will be explained later in this article).QueryPlanner.winningPlan.inputStage: Used to describe the child stage and provide document and index keywords for its parent stage.QueryPlanner.winningPlan.stage's child stage, here is Ixscan, indicates that the index scanning is being carried out.QueryPlanner.winningPlan.keyPattern: The index content scanned, here is did:1,status:1,modify_time:-1 and Scid:1Index selected by QueryPlanner.winningPlan.indexName:winning plan.If the QueryPlanner.winningPlan.
collection DBCollection" and use the getCollection method of the db object.
DBCollection users = db. getCollection ("users ");
In this way, we get a DBCollection, which is equivalent to the "table" of our database, which is called a collection in MongoDB.
Query all data
DBCursor cur = users. find ();
While (cur. hasNext ()){
System. out. println (cur. next ());
}
Complete source code
2. To complete the
[MongoDB] The high query operation of MongoDB (III), mongodboperation1, Sort
Needless to say, mongodb also support to sort data. THe positive one means sorting by asc order and negetive means by desc.
2. Group
The grammar of group:
Description Of Argument:
Key: The field need to group
Cond:
MongoDB Introduction
MongoDB is a database based on distributed file storage. Written by the C + + language. Designed to provide scalable, high-performance data storage solutions for WEB applications.
MongoDB is a product between relational database and non relational database, and is the most powerful and relational database in the relational database.
Here a
[MongoDB] The Regex Expression query of MongoDB, mongodbregex
In the past two blogs, the topic mainly focus on the high query operation of mongodb. in this blog, we simply study the regex expression in the mongdb. mongoDB also sup
PHP simple MongoDB operation method (installation, addition, deletion, modification, and query), mongodb addition and Deletion
This article describes how to operate MongoDB in PHP. We will share this with you for your reference. The details are as follows:
For php operations on Mon
", "Age": "23"}{"_id": ObjectId ("537772e9d67df098a26d79a6"), "age": +, "name": "Xiao Li", "Password": "Xiaozhang"}9. Update objectsWe can combine the "MongoDB shell command"db.person.update ({name: "Xiao Li"},{$set: {password: "Hello"}}) to understand how Java is manipulating objects to be updated. {name: "Xiao Li"} is a basicdbobject. {$set: {password: ' Hello '} is also a basicdbobject. Understand the wo
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.