Skip to main content

Adding Sample Data

Now that we've created our subjects and our predicates, we can add in sample data to our application.

We can add a new person to our ledger the same way that we added a new _predicate or a new _collection. We need to have an _id whose value is the name of the collection that our new subject belongs to (person), and then we can add as many keys as predicates we want to specify.

For example, to create two people with fullNames and handle, we can issue the following transaction:

"_id": "person",
"fullName": "Jane Doe",
"handle": "jdoe"
"_id": "person",
"fullName": "Zach Smith",
"handle": "zsmith"

Adding Multi Predicates

Some of the predicates that we added are multi predicates, meaning we can add more than one object (value) to that predicate. When creating a person and specifying favNums, the value for favNums needs to be inside of square brackets, [ and ]. This is true even if we're only adding one favorite number.

For example:

"_id": "person",
"fullName": "Fluree Person",
"favNums": [1, 14, 28]

Create 3 New People

Write a transaction to create the 3 new people with the following information

  • A person with the full name, Alton Brown, handle, aBrown, and favorite numbers: 89 and 7
  • A person with the full name, Oprah Winfrey, handle, oWinfrey, and favorite numbers: 2, 6 and 908
  • A person with the full name, Roger Goodell, handle, rGood, and favorite numbers: 2