Open rosscado opened 6 years ago
Accomplishments so far:
GET /events
resources are retrieved from a persistent document store.POST /events
resources are attributed id
attributes (transient).test_events
) database to production (events
).I only have a single Cloudant database instance available under the Lite/free plan.
I have bound the instance to the staging
space app, leaving it unavailable to the production
app. For this reason production
can't be started for now.
I am pausing completion of the persistence feature until I have more functional work done first, specifically implementing event APIs #2
Our entity/resource documents will sometimes contain nested entities/resources that are best represented as their own documents, rather than embedded.
This article explains how to represent such a relationship in a Cloudant/CouchDB NoSQL database: https://wiki.apache.org/couchdb/EntityRelationship
Model:
---
_id: event_id
type: event
organising_club_id: club_id
---
_id: club_id
type: club
Client logic:
club = {'title': 'Little Club'}
club = db.create_document(club)
event = {'title': 'Big Race', 'organising_club_id': club['_id']}
event = db.create_document(event)
No view is required for a 1:1 or many:1 relationship. Views are required for 1:many relationships.
Save resources to a backend database.