Skip to content

Latest commit

 

History

History
22 lines (16 loc) · 1.11 KB

database.md

File metadata and controls

22 lines (16 loc) · 1.11 KB

Generic JSON Database API

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

Implemented JSON databases

Other JSON capable databases can be added easily (pull requests welcome!) by writing a wrapper that supports each of the above methods.

Smart database objects

expressa-folder will automatically add functions to objects returned by all,find and get