MongoDB and Redis crud (create,read,update,delete)

Source: Internet
Author: User

After you've installed MongoDB, you can try running the JavaScript shell.
Under Mac, from the installation to the shell that can run MONGO, the steps are as follows:
1. Find the website of MongoDB. Download the appropriate installation package. such as DMG under the Mac
2. Unzip the installation.
3. Configure the environment variables.
The details will not be expanded, since another article has been mentioned.

MongoDB crud, is a very basic database content, in the Turing series of MongoDB inside the first chapter is crud.
Open the MongoDB script, that is, typing MONGO directly, you can start testing the following statement.

Create:

Post = {"title": "C", "Content": "Create"}
Db.blog.insert (POST)

First create a "signal" and then insert the signal into the database

Read:

Db.blog.find ()
Db.blog.findOne ()
Db.blog.fing (). Pretty ()

The. Pretty () is able to make the format look good when displayed.

Update:

Post.comment = []
Db.blog.update ({title: "C"}, Post)

First update the post to the signal, then send the post to the database and find the one that should be updated

Delete:
Db.blog.remove ({title: "C"})

Another database to master is Redis,redis's web site provides a very interesting tutorial, interactive, while knocking, while teaching.
Not much to master.

A set a Get

Set Genius Charlie
Get Genius

Some data structures, list, set, sorted set, hash.
Each kind has some basic cmd, does not bother to remember, the check API is good.

MongoDB and Redis crud (create,read,update,delete)

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.