samjs-mongo-deletion
Deletion module for the mongo plugin for samjs. Use it when you want a user to be able flag an document as deleted. Afterwards only authenticated users can find, unflag or really remove it.
Client: samjs-mongo-deletion-client
Example
samjs = require "samjs" samjspluginsrequire"samjs-mongo" require"samjs-mongo-auth"require"samjs-mongo-deletion"optionsconfig:"config.json"configsmodels name: "someModel" db: "mongo" plugins: auth: null deletion: delete: "root" write: "all" schema: someProp: type: String read: "all" write: "root"startupiolisten3000 #will be in config mode, then in install mode, after install: samjsstartedthen -> # not in install mode anymore #client in browser samjs = require"samjs-client"url: windowlocationhost+":3000/"samjspluginsrequire "samjs-mongo-client" require "samjs-mongo-auth-client"require "samjs-mongo-deletion-client" ## after configuration and install (see samjs-mongo-auth for example) someModel = "someModel"# has insert / count / find / update / remove someModelinsert someProp:"someValue"then someModeldelete resultthen someModelfind resultthen result # [] samjsauthlogin name:#rootName,pwd:#rootpw} then -> #success someModelfind someProp:"someValue"then result # [{someProp:"someValue",_id:"#theID"}]