prospekt
prospekt

Reputation: 97

Creating object like entries with levelup DB, relating keys

I'm no aficionado of databases and I'm new to level as I've only dealt with SQL. My question seems simple, while I can put and get key value pairs in level, how do I create a record with more attributes?

So like I have key="president" and value="Nixon", but how can I give that value attributes? ie:

"Nixon":[{"approvalRating": 10, "suitColor":"blue", "firstName":"Richard"}]

How can I interact with level to get results like this?

Thanks

Upvotes: 0

Views: 173

Answers (1)

Molda
Molda

Reputation: 5704

The value can be object so instead of "Nixon" you could pass in

{
    lastname: 'Nixon',
    firstName:'Richard'
    approvalRating: 10, 
    suitColor:'blue'
}

Upvotes: 2

Related Questions