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)