mongodb

package
v0.2.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 15, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

+marmot:name=MongoDB +marmot:description=This plugin discovers databases and collections from MongoDB instances. +marmot:status=experimental

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	plugin.BaseConfig `json:",inline"`

	ConnectionURI string `json:"connection_uri" description:"MongoDB connection URI (overrides host/port/user/password)"`
	Host          string `json:"host" description:"MongoDB server hostname or IP address"`
	Port          int    `json:"port" description:"MongoDB server port (default: 27017)"`
	User          string `json:"user" description:"Username for authentication"`
	Password      string `json:"password" description:"Password for authentication"`
	AuthSource    string `json:"auth_source" description:"Authentication database name"`
	TLS           bool   `json:"tls" description:"Enable TLS/SSL for connection"`
	TLSInsecure   bool   `json:"tls_insecure" description:"Skip verification of server certificate"`

	IncludeDatabases   bool           `json:"include_databases" description:"Whether to discover databases" default:"true"`
	IncludeCollections bool           `json:"include_collections" description:"Whether to discover collections" default:"true"`
	IncludeViews       bool           `json:"include_views" description:"Whether to include views" default:"true"`
	IncludeIndexes     bool           `json:"include_indexes" description:"Whether to include index information" default:"true"`
	SampleSchema       bool           `json:"sample_schema" description:"Sample documents to infer schema" default:"true"`
	SampleSize         int            `json:"sample_size" description:"Number of documents to sample (default: 1000, -1 for entire collection)" default:"1000"`
	UseRandomSampling  bool           `json:"use_random_sampling" description:"Use random sampling for schema inference" default:"true"`
	DatabaseFilter     *plugin.Filter `json:"database_filter,omitempty" description:"Filter configuration for databases"`
	CollectionFilter   *plugin.Filter `json:"collection_filter,omitempty" description:"Filter configuration for collections"`
	ExcludeSystemDbs   bool           `json:"exclude_system_dbs" description:"Whether to exclude system databases (admin, config, local)" default:"true"`
}

Config for MongoDB plugin +marmot:config

type MongoDBFields

type MongoDBFields struct {
	Host             string `json:"host" metadata:"host" description:"MongoDB server hostname"`
	Port             int    `json:"port" metadata:"port" description:"MongoDB server port"`
	Database         string `json:"database" metadata:"database" description:"Database name"`
	Collection       string `json:"collection" metadata:"collection" description:"Collection name"`
	ObjectType       string `json:"object_type" metadata:"object_type" description:"Object type (collection, view)"`
	Size             int64  `json:"size" metadata:"size" description:"Collection size in bytes"`
	DocumentCount    int64  `json:"document_count" metadata:"document_count" description:"Approximate document count"`
	Created          string `json:"created" metadata:"created" description:"Creation timestamp if available"`
	Capped           bool   `json:"capped" metadata:"capped" description:"Whether the collection is capped"`
	MaxSize          int64  `json:"max_size" metadata:"max_size" description:"Maximum size for capped collections"`
	MaxDocuments     int64  `json:"max_documents" metadata:"max_documents" description:"Maximum document count for capped collections"`
	StorageEngine    string `json:"storage_engine" metadata:"storage_engine" description:"Storage engine used"`
	IndexCount       int    `json:"index_count" metadata:"index_count" description:"Number of indexes on collection"`
	ShardingEnabled  bool   `json:"sharding_enabled" metadata:"sharding_enabled" description:"Whether sharding is enabled"`
	ShardKey         string `json:"shard_key" metadata:"shard_key" description:"Shard key if collection is sharded"`
	Replicated       bool   `json:"replicated" metadata:"replicated" description:"Whether collection is replicated"`
	ValidationLevel  string `json:"validation_level" metadata:"validation_level" description:"Validation level if schema validation is enabled"`
	ValidationAction string `json:"validation_action" metadata:"validation_action" description:"Validation action if schema validation is enabled"`
}

MongoDBFields represents MongoDB-specific metadata fields +marmot:metadata

type MongoDBIndexFields

type MongoDBIndexFields struct {
	Name          string `json:"name" metadata:"name" description:"Index name"`
	Fields        string `json:"fields" metadata:"fields" description:"Fields included in the index"`
	Unique        bool   `json:"unique" metadata:"unique" description:"Whether the index enforces uniqueness"`
	Sparse        bool   `json:"sparse" metadata:"sparse" description:"Whether the index is sparse"`
	Background    bool   `json:"background" metadata:"background" description:"Whether the index was built in the background"`
	TTL           int    `json:"ttl" metadata:"ttl" description:"Time-to-live in seconds if TTL index"`
	Partial       bool   `json:"partial" metadata:"partial" description:"Whether the index is partial"`
	PartialFilter string `json:"partial_filter" metadata:"partial_filter" description:"Filter expression for partial indexes"`
	Type          string `json:"type" metadata:"type" description:"Index type (e.g., single field, compound, text, geo)"`
}

MongoDBIndexFields represents MongoDB index metadata +marmot:metadata

type MongoDBSchemaFields

type MongoDBSchemaFields struct {
	FieldName    string   `json:"field_name" metadata:"field_name" description:"Field name"`
	DataTypes    []string `json:"data_types" metadata:"data_types" description:"Observed data types"`
	IsRequired   bool     `json:"is_required" metadata:"is_required" description:"Whether field appears in all documents"`
	Frequency    float64  `json:"frequency" metadata:"frequency" description:"Frequency of field occurrence in documents"`
	SampleValues string   `json:"sample_values" metadata:"sample_values" description:"Sample values from documents"`
	Description  string   `json:"description" metadata:"description" description:"Field description from validation schema if available"`
}

MongoDBSchemaFields represents MongoDB schema metadata from schema sampling +marmot:metadata

type Source

type Source struct {
	// contains filtered or unexported fields
}

func (*Source) Discover

func (s *Source) Discover(ctx context.Context, pluginConfig plugin.RawPluginConfig) (*plugin.DiscoveryResult, error)

func (*Source) Validate

func (s *Source) Validate(rawConfig plugin.RawPluginConfig) error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL