How To
Understanding Swimlane Plugin collections in MongoDB
in this article, weāll learn how a pluginās data is stored in mongodb and how this data is used in swimlane for illustrative purposes, weāll use the sw virus total plugin for all examples given below table of contents package descriptors asset descriptors available action descriptors assets files and chunks tasks package descriptors this collection has one document related to the sw virus total plugin the document includes basic information about the plugin including readme (overview) and changelog data mongodb following is sample output from the 'packagedescriptors' collection db getcollection('packagedescriptors') find({" id" "sw virus total"}) swimlane application ui the data is displayed in the āintegrationsā section in āplugins ā overviewā and āplugins ā change logā asset descriptors this collection has one document related to the sw virus total plugin the document includes information on asset definition mongodb following is sample output from the 'assetdescriptors' collection db getcollection('assetdescriptors') find({"packagedescriptor name" "sw virus total"}) swimlane application ui the data is displayed in the āintegrationsā section in āplugins ā assetsā available action descriptors this collection contains as many documents as the number of task actions available specifically for the sw virus total plugin mongodb following is a sample output of availableactiondescriptors collection db getcollection("availableactiondescriptors") find({"packagedescriptor name" "sw virus total"}) filter by the name field db getcollection("availableactiondescriptors") find({"packagedescriptor name" "sw virus total"}, {name 1}) swimlane application ui the data is displayed in the āintegrationsā section under āplugins ā actionsā and ātasks ā create a taskā assets this collection contains as many documents (s) as the number of assets created for the sw virus total plugin a plugin can be associated with multiple assets mongodb following is a sample output of 'assets' collection db getcollection('assets') find({"descriptor packagedescriptor name" "sw virus total"}) filter by the name field db getcollection('assets') find({"descriptor packagedescriptor name" "sw virus total"}, {name 1}) swimlane application ui the data is displayed in the āintegrationsā section under āassetsā files and chunks per mongodb, ā gridfs is a specification for storing and retrieving files that exceed the bson document size limit of 16 mb instead of storing a file in a single document, gridfs divides the file into parts, or chunks \[1] , and stores each chunk as a separate document ā it is a file system to store files, but its data is stored within mongodb collections the collection, āfs chunksā, stores the document parts while the collection, āfs filesā stores the fileās metadata swimlane uses this system to store the actual plugin file ( swimbundle) when it is first uploaded in swimlane upon restart of swimlane, the plugins are re installed into the containers using the file data available in these two collections mongodb following is a sample output of āfs filesā and āfs chunksā collection db getcollection('fs files') find({filename /sw virus total/}) db getcollection('fs chunks') find({'files id' '< id>'}) tasks this collection contains all tasks of type email import, powershell core, python 3 6, python 2 7, network file, api, plugin based task action (non forked), and plugin based task action (forked) mongodb the following query will list all tasks that use the sw virus total plugin task actions db getcollection('tasks') find({"action descriptor packagedescriptor name" "sw virus total"}) filter by name and action type db getcollection('tasks') find({"action descriptor packagedescriptor name" "sw virus total"}, {name 1, "action t" 1}) the following query will list all tasks forked based on the sw virus total plugin task actions db getcollection('tasks') find({"action forkedfrompackage" "sw virus total"}) filter by name and action type db getcollection('tasks') find({"action forkedfrompackage" "sw virus total"}, {name 1, "action t" 1}) related queries return a list of installed plugins db getcollection('packagedescriptors') distinct('name') find all the tasks associated with a particular assetid db getcollection('tasks') find({'action assetid' '\<assetid>'})