Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Storing data

From: Up and Running with NoSQL Databases

Video: Storing data

Many NoSQL databases store data without a predefined schema, and CouchDB is no exception. In this video, we'll start up CouchDB and start storing some data. First, go to your Applications folder, and navigate to CouchDB. When you double-click on CouchDB, it automatically opens up the Futon interface. We already have a couple of databases in this fresh server. We have _replicator and _users. These two databases are used to help run CouchDB.

Storing data

Many NoSQL databases store data without a predefined schema, and CouchDB is no exception. In this video, we'll start up CouchDB and start storing some data. First, go to your Applications folder, and navigate to CouchDB. When you double-click on CouchDB, it automatically opens up the Futon interface. We already have a couple of databases in this fresh server. We have _replicator and _users. These two databases are used to help run CouchDB.

CouchDB uses these databases as a way of organizing documents in specific sets. Databases are also used to enforce security and access control across all of the documents that are part of that database. In this course, we'll be creating a website for a restaurant. So let's create a database to support that. Click the Create Database link and then give the database a name of restaurant. Then click Create.

Now, we have a fresh database with no documents in it. Let's create the first document by clicking New Document. You'll notice that it automatically gave us a hash for the ID field. Under normal circumstances, you'll want to accept this hash value unless you have a good reason not to use it. Now, let's start filling in this document. I'm going to go to the exercise files, and then open content.txt. So, let's create a welcome document now.

I'm copying Welcome, and now I'm going to click Add Field. I'm going to give this field a name of name, and the value is going to be Welcome. I now also want to create another field for the content. Let's copy The Corner Cafe, and now click Add Field again, and give this field the name of content, and then paste in The Corner Cafe. Once these values are in the document, click the green check next to each value.

Now, finally click Save Document. You'll notice that the _rev field got added. This keeps track of the revision number. Each time we make a change to this document, this revision number is going to increment. Let's create another document in this database. Click on restaurant, and click on New Document. We're going to call this document Hours. So click Add Field and then type in name, add another field and call it content.

And now copy in the hours. Click the green check next to each field, and then click Save Document. Now I'm going to add one more field. I'm going to call this author. Then, I'm going to add my name here. Click the green check, and then click Save Document. Now, let's click restaurant, and then open these two documents in new tabs. You'll notice that we have this content here for The Corner Cafe and the name is Welcome, while we have author here as another field in addition to content and name.

Even though these two documents are in the same database, they have different field sets. And this is okay because that's something that CouchDB allows. Storing data in CouchDB is as easy as naming a database and naming field-value pairs. The structure does not have to be the same from document to document. You can add the exact fields you want for each one.

Show transcript

This video is part of

Image for Up and Running with NoSQL Databases
Up and Running with NoSQL Databases

29 video lessons · 11498 viewers

Joseph LeBlanc
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Up and Running with NoSQL Databases.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.