This article mainly introduces MongoDB various query operation details, including comparison query, correlation query, array query and so on, the need for friends can refer to the nextOne, find operationsMongoDB uses find to query, and all and part
SummaryIn the work also often use MongoDB, each encounter new operations need to check, more trouble, ready to blog in the system to learn MongoDB. First install the MONGODB environment locally, you can download a version of Windows.Official
Common Basic data types:
Null
Null is used for fields that represent null values or that do not exist:{"Data": null}
Boolean type
A Boolean type has only two values, True and false:{"Data": true}, {"Data": false}
SummaryThe previous article learned about MongoDB installation on Windows, and how to open MongoDB, and finally lists simple additions and deletions to check the operation. This article will continue in-depth study and add and delete changes.Related
1. InstallationMethod 1:mac The computer is easy to install, directly download the required version of the decompression can:Download URLHttps://www.mongodb.com/download-center?jmp=nav#communityMethod 2:Brew Install MongoDB2. MongoDB data default
Download MongoDB: https://www.mongodb.com/download-center?jmp=nav#community Here is the installation of MongoDB under the Windows platform, After downloading, on this computer, follow the prompts to install. Note: This installation is only to get
I. MongoDB INTRODUCTIONMongoDB installation without adding any parameters, by default, there is no permission authentication, logged on users can be arbitrary operation of the database and can access the database remotely, need to start with the
>> Create:Db.foo.insert ({"Bar": "Baz"})//If there is no "_id" key in the document automatically adds aDb.foo.batchinsert ([{"_id": 0},{"_id": 2}])applicable to inserting multiple documents into a single collection, multiple documents cannot be
View the latest version of MongoDB official:Https://www.mongodb.com/download-center#communityDownload the installation package using the wget commandwget https://fastdl.mongodb.org/linux/mongodb-linux-x86_64-rhel70-3.2.6.tgz Tar zxvf
MongodbInsert DocumentIn this section we will show you how to insert data into a collection of MongoDB.The data structure of the document is basically the same as JSON.All data stored in the collection is in the Bson format.Bson is a binary form of
MongoDB: https://www.mongodb.com/download-center#community;MongoDB download After the installation, choose Custom Installation, installed into a root directory, such as c,d,e,f disk;After MongoDB is installed, there will be a bin folder in the root
Use Gradle. Find the latest version http://mvnrepository.org/" org.mongeez:mongeez:0.9.6 "Configure Spring"Mongeez" class="Org.mongeez.MongeezRunner"depends-on="MONGO"> "MONGO" ref="MONGO"/> "executeenabled"Value="true"/> "DbName"Value="Test"/>
MongoDB Installation
The version used is 3.0 and the virtual machine operating system is rhel-server-7.0-x86_641. Upload and unzip the mongodb-linux-x86_64-rhel70-3.0.11.tgz to the/usr/local/mongodb directory2. Setting Environment variables#
Below is MongoDB simple additions and deletions (news category)Attached: Query.addcriteria (Criteria.where ("ModelID"). NE (""). NE (null)); Non-emptyQuery.with (New Sort (New Order (direction.desc, "CT"))); FlashbacksSort multiple fields: first
Sort () methodTo sort documents in MongoDB, you need to use the sort () method. The sort () method accepts a document that contains a list of fields together with their sort order. To specify sort order 1 and-1. 1 is used in ascending order, and-1
You can use Db.copydatabase to back up the method of copying data.1.db.copydatabase ("from", "to", "127.0.0.1:16161"), copy a new to database. This is already the smallest data footprint. The data file of the to is generated in the database
1. Full-Text Search concept:Full-Text search is to establish an index of each word, indicating the number and location of the word in the article, when the user queries, the retrieval program based on the pre-established index to find, and the
1. DownloadAddress: Http://www.mongodb.org/downloads (32-bit or 64-bit choice).I downloaded: mongodb-win32-x86_64-2.4.5.zip2. DecompressionPut the mongodb-win32-x86_64-2.4.5.zip in one place and unzip it. I put it in the D:\dev directory.The path
To install MongoDB self-search, I offer here a GUI version similar to Navicat.1. Database levelShow DBS #查看服务器上的数据库 [local 0.000GB]Use test #切换到指定数据库 if test does not exist in the database, the test database will be createdDB #查看当前数据库
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