Dataset Basics

Wix has a database built into the editor that allows you to store data, and use it to display content. They’ve made the challenging part of database management a breeze with their Content Manager, collections, and datasets.

Storing Data

Data is stored in a database, located in the back-end of a website (an inaccessible component that visitors don’t interact with). Database usage can range in complexity, from something as simple as storing a user’s profile picture, to more complex systems that monitor and keep track of years of important financial transactions.

Let’s say you’re building a website to showcase your last vacation - a road trip to visit your favorite national parks. A good use case for a database would be to store memorable moments along the way, and display them on the front-end (the visible part of a website that visitors interact with). Storing this information in one place lets you have more flexibility to organize, edit, and update the information easily, and as often as you like!

Collections

You’re probably wondering “how does the data get into the database?”. This is where collections come in. Collections are tables of data inside of the built-in database. If you’ve ever used a spreadsheet, you have a basic understanding of how a collection works. Each row represents an item in the collection - a destination on your road trip. And each column represents a field - the title, image, and description for the destination.

Wix Collection Table

In the image below, the Title, Image, and Description from your collection are automatically filled into the element. As you can see, using a database in this manner can significantly speed up development.

Wix Page Element from Collection

Datasets

Once data is stored in a collection, it is ready to be displayed on your site. Wix has a clever way of connecting collection data to the elements on your page by using datasets.

Datasets are like imaginary wires between your collection and page elements. Through these wires, data is transferred to and from the elements on your page.

In the road-trip example, a dataset will:

  • Make the connection from the collection to the page elements.
  • Set the content on the page.
  • Set the mode for how visitors will interact with the page elements.
  • Sort and filter the destinations you choose to display.

Dataflow Graphic

As you can see, the database is where you store collections. From the collection’s data, you can create a dataset that provides an element with information to display. Datasets are the magic keys to linking your database and your front-end.

Beyond

Using the built-in database, collections, and datasets, you now have an idea of how data can be used on your site. Head on over to Wix to see more examples of how you can use these features!

Author

Codecademy Team

'The Codecademy Team, composed of experienced educators and tech experts, is dedicated to making tech skills accessible to all. We empower learners worldwide with expert-reviewed content that develops and enhances the technical skills needed to advance and succeed in their careers.'

Meet the full team