You can access a collection's database using `expressa.db[collectionName].action where action is one of the following:
- all - returns all documents
- find - returns array of documents matching the mongo query
- get - retrieve a document by id
- create - create a new document
- update - modify an existing document
- delete - delete a document by id
- init - called once during startup, useful to create/ensure collection exists
- MongoDB
- PostgreSQL (using jsonb and mongo-query-to-postgres-jsonb)
- Text files (using json-file-store and mongo-query)
Other JSON capable databases can be added easily (pull requests welcome!) by writing a wrapper that supports each of the above methods.
expressa-folder will automatically add functions to objects returned by all
,find
and get