User Tools

Site Tools


sib:callers:mongocaller

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
sib:callers:mongocaller [2019/05/13 11:38]
hubbe
sib:callers:mongocaller [2019/05/17 07:56] (current)
hubbe
Line 42: Line 42:
  allowOperations:​ ["​find",​ "​findone",​ "​insert"​],​  allowOperations:​ ["​find",​ "​findone",​ "​insert"​],​
  allowOverride:​ ["​insert",​ "​find"​],​  allowOverride:​ ["​insert",​ "​find"​],​
- inputFormat:​ (topic, msg, cb)=>{+ inputFormat:​ (topic, msg, cb, mongoDB)=>{
  cb(msg);  cb(msg);
  },  },
Line 56: Line 56:
  database: "​sibtest"​  database: "​sibtest"​
  },  },
- outputFormat:​ (topic, msg, cb)=>{+ outputFormat:​ (topic, msg, cb, mongoDB)=>{
  delete( msg.filter );  delete( msg.filter );
  cb(msg);  cb(msg);
Line 80: Line 80:
   * allowOperations:​ Array containing a list of operations from the "​supported operations list" permitted by this service.   * allowOperations:​ Array containing a list of operations from the "​supported operations list" permitted by this service.
   * allowOverride:​ Array containing a list of operations from the "​supported operations list" for which the listener is allowed to override the standard parameters like filter, options etc.   * allowOverride:​ Array containing a list of operations from the "​supported operations list" for which the listener is allowed to override the standard parameters like filter, options etc.
-  * inputFormat(topic,​ msg, callback): The method that is run on service activation. The original message is passed as the argument and the input value to the callback must be a JSON formatted message conforming to the SIB message standard.+  * inputFormat(topic,​ msg, callback, mongoDB): The method that is run on service activation. The original message is passed as the argument and the input value to the callback must be a JSON formatted message conforming to the SIB message standard. The fourth optional parameter is a reference to the mongoClient database object.
   * loggerCfg: A JSON Object defining what logger actions should be active for this service (see [[sib:​loggerConfiguraton|Logger Configuration]]   * loggerCfg: A JSON Object defining what logger actions should be active for this service (see [[sib:​loggerConfiguraton|Logger Configuration]]
   * mongo: Database configuration   * mongo: Database configuration
     * connectionstring:​ String on the MongoDB URI format specifying which mongoDB server to connect to     * connectionstring:​ String on the MongoDB URI format specifying which mongoDB server to connect to
     * database: The name of the database to use     * database: The name of the database to use
-  * outputFormat(topic,​ msg, callback): This message is run on the response data before publishing to the response topic. The response message is passed as the argument and the input to the callback must be a JSON formatted message conforming to the SIB message standard.+  * outputFormat(topic,​ msg, callback, mongoDB): This message is run on the response data before publishing to the response topic. The response message is passed as the argument and the input to the callback must be a JSON formatted message conforming to the SIB message standard. The fourth optional parameter is a reference to the mongoClient database object.
   * mqtt: The MQTT connection string for the internal MQTT transport   * mqtt: The MQTT connection string for the internal MQTT transport
   * std: Standard settings for operation parameters. These are used if allowOverride does not specify the current operation or if no parameter is set in the received message   * std: Standard settings for operation parameters. These are used if allowOverride does not specify the current operation or if no parameter is set in the received message
sib/callers/mongocaller.txt ยท Last modified: 2019/05/17 07:56 by hubbe