MongoDB Knowledge Summary

Source: Internet
Author: User
Tags mongoclient

Agenda

    • Traits
Agility,scalability,high-performancefree and Open-sourcenosql databasejson-likedocument-oriented database (schema Flexible)
    • Document Database
A record in MongoDB was a document, which is a data structure composed of field and value pairs. MongoDB is similar to JSON objects.
    • SQL to MongoDB Mapping Chart
The following table presents the various SQL terminology and concepts and the corresponding MongoDB terminology and CONCEP Ts.
    • Connect to MongoDB
MongoDB default port is 27017, and the default local host is 127.0.0.1

Mongoclient MONGO

= new Mongoclient ("hostname", 27017);

DB db = Mongo.getdb ("Dataqueuenode");

Dbcollection collection = db.getcollection ("entity");

    • MongoDB CRUD in Java

Basicdbobject query = new Basicdbobject ();

Query.put ("type", "s2f");

Query.put ("Subtype", "SQL Orders");

Query.put ("state", "disputed");

Query Document

Collection.findone (DBObject o); Search one specific record

Collection.find (DBObject o); Search all specific records

Remove Document

Collection.remove (DBObject o); Remove specific records

Insert Document

Collection.insert (DBObject arr); Insert Record

Modify Document

Collection.update (dbobject q, DBObject o); Update record

* @param q The selection criteria for the update

* @param o the modifications to apply

    • MongoDB command

Reference
Doc:http://docs.mongodb.org/manual/core/crud-introduction

    • One Shell for MongoDB

Mongovue

The condition operators in MongoDB are:

    • (>) Greater than-$GT
    • (<) less than-$lt
    • (>=) greater than or equal to-$gte
    • (<=) less than or equal to-$lte
>db.testtable.find ({age: {$gt: 22}})

MongoDB Knowledge Summary

Related Article

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.