samjs-mongo-configwise

0.1.1 • Public • Published

samjs-mongo-configwise

A module for the mongo plugin for samjs. Exposes a model for each entry of a given config item.

Example

samjs.plugins(require("samjs-mongo"),require("samjs-mongo-configwise"))
.options({config:"config.json"})
.configs({name:"someConfig",read:true,write:true})
.models({
  name:"someModel"
  db:"mongo",
  plugins:
    configwise:
      configName: "someConfig"
      propName: "name"
  schema:
    name: String
}).startup().io.listen(3000)
## client side
samjs = require("samjs-client")({url: window.location.host+":3000/"})
samjs.plugins(require "samjs-mongo-client")
samjs.config.set "someConfig", [name:"first",name:"second"]
.then ->
  # two independet tables with the same schema
  someModelfirst = new samjs.Mongo("first.someModel")
  someModelsecond = new samjs.Mongo("second.someModel")

Readme

Keywords

none

Package Sidebar

Install

npm i samjs-mongo-configwise

Weekly Downloads

0

Version

0.1.1

License

none

Last publish

Collaborators

  • paulpflug