db-spec Pub


The document database model is used to keep state and there are a few kinds available:

  • memdb - in memory, per user
  • shareddb - in memory, per app
  • col - persisted, available for paid accounts, depending on volume

The generic operations are:

  • upsert(collection, id, document) => (id) - update or create document with given value
  • getsert(collection,id,default) => (document) - get or create, if default given. If no default and nothing found, it will return an Undefined
  • query(collection,parmA,parmB...) => (documents) - query documents, based on document properties
  • clear(collection) - delete all entries from one collection / one document type... *careful with this one...

Generic DB operations

These are implemented by all DB types and instances:

msg diesel.db.INST.upsert  (collection, id, document)

msg diesel.db.INST.getsert  (collection, id, default)

msg diesel.db.INST.query  (collection)

msg diesel.db.INST.clear  (collection)

Mem DB

The in-memory database is good to mock up functions that require a bit of state. You should not rely on it being available or persisted for too long :).

msg diesel.db.memdb.upsert  (collection, id, document)

msg diesel.db.memdb.getsert  (collection, id, default)

msg diesel.db.memdb.query  (collection)

msg diesel.db.memdb.log 

msg diesel.db.memdb.clear 

Shared DB

The shared database is good to mock up functions that require a bit of state. This one is persisted and available in a cluster (in case of transparent restarts of processing nodes etc).

msg diesel.db.shareddb.upsert  (collection, id, document)

msg diesel.db.shareddb.getsert  (collection, id, default)

msg diesel.db.shareddb.query  (collection)

msg diesel.db.shareddb.log 

msg diesel.db.shareddb.clear 

Persisted DB

This is an actual persisted DB - avaialble for paid member accounts.

msg diesel.db.col.upsert  (collection, id, document)

msg diesel.db.col.getsert  (collection, id, default)

msg diesel.db.col.query  (collection)

msg diesel.db.col.clear  (collection)

Was this useful?    

By: Razie | 2019-10-04 | Tags: spec , dsl

Viewed 74 times ( | Print ) this page.

You need to log in to post a comment!

© Copyright DieselApps, 2012-2020, all rights reserved.