Documentation
¶
Overview ¶
Package datagen used to generate millions of pseudo-random BSON documents and insert them into a Mongodb instance.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Collection ¶
type Collection struct {
// Database to use
DB string `json:"database"`
// Collection name in the database
Name string `json:"collection"`
// Number of documents to insert in the collection
Count int `json:"count"`
// Schema of the documents for this collection
Content map[string]generators.Config `json:"content"`
// Compression level for a collection. Available for `WiredTiger` only.
// can be none|snappy|zlib. Default is "snappy"
CompressionLevel string `json:"compressionLevel"`
// List of indexes to build on this collection
Indexes []Index `json:"indexes"`
// Sharding information for sharded collection
ShardConfig ShardingConfig `json:"shardConfig"`
// contains filtered or unexported fields
}
Collection struct storing global collection info
func ParseConfig ¶
func ParseConfig(content []byte, ignoreMissingDb bool) (collections []Collection, err error)
ParseConfig returns a list of Collection to create from a json configuration file
type Configuration ¶
type Configuration struct {
ConfigFile string `short:"f" long:"file" value-name:"<configfile>" description:"JSON config file. This field is required\n"`
Append bool `` /* 146-byte string literal not displayed */
IndexOnly bool `short:"i" long:"indexonly" description:"if present, mgodatagen will just try to rebuild index"`
IndexFirst bool `short:"x" long:"indexfirst" description:"if present, mgodatagen will create index before\n inserting documents"`
NumInsertWorker int `` /* 147-byte string literal not displayed */
BatchSize int `short:"b" long:"batchsize" value-name:"<size>" description:"bulk insert batch size" default:"1000"`
Seed uint64 `` /* 203-byte string literal not displayed */
Output string `` /* 153-byte string literal not displayed */
PrettyPrint bool `long:"prettyprint" description:"if present, indent the output. Only for stdout or file\n output"`
}
Configuration struct that stores info on config file from command line args
type Connection ¶
type Connection struct {
URI string `` /* 213-byte string literal not displayed */
Host string `short:"h" long:"host" value-name:"<hostname>" description:"mongodb host to connect to" default:"127.0.0.1"`
Port string `long:"port" value-name:"<port>" description:"server port" default:"27017"`
UserName string `short:"u" long:"username" value-name:"<username>" description:"username for authentification"`
Password string `short:"p" long:"password" value-name:"<password>" description:"password for authentification"`
AuthMechanism string `` /* 146-byte string literal not displayed */
TLSCertKeyFile string `long:"tlsCertificateKeyFile" value-name:"<path>" description:"PEM certificate/key file for TLS"`
TLSCAFile string `long:"tlsCAFile" value-name:"<path>" description:"Certificate Authority file for TLS"`
Timeout time.Duration
}
Connection struct that stores info on connection from command line args
type General ¶
type General struct {
Help bool `long:"help" description:"show this help message"`
Version bool `short:"v" long:"version" description:"print the tool version and exit"`
Quiet bool `short:"q" long:"quiet" description:"quieter output"`
}
General struct that stores global options from command line args
type Index ¶
type Index struct {
Name string
// use an ordered map because key order matters for compound index,
// see https://docs.mongodb.com/manual/core/index-compound/
Key orderedmap.OrderedMap
Unique bool
Sparse bool
Bits int32
Min float64
Max float64
ExpireAfter int32 `json:"expireAfterSeconds"`
Weights bson.M
DefaultLanguage string
LanguageOverride string
TextIndexVersion int32
PartialFilterExpression bson.M
Collation options.Collation
Hidden bool
StorageEngine bson.M
WildcardProjection bson.M
SphereIndexVersion int32 `json:"2dsphereIndexVersion"`
// ignored from mongodb 4.2+
Background bool
DropDups bool
// deprecated from mongodb 4.9
BucketSize int32
}
Index struct used to create an index
func (*Index) ConvertToIndexModel ¶ added in v0.10.2
func (idx *Index) ConvertToIndexModel() mongo.IndexModel
type Options ¶
type Options struct {
Template `group:"template"`
Configuration `group:"configuration"`
Connection `group:"connection infos"`
General `group:"general"`
}
Options struct to store flags from CLI
type ShardingConfig ¶
type ShardingConfig struct {
ShardCollection string `bson:"shardCollection"`
Key bson.M `bson:"key"`
NumInitialChunks int `bson:"numInitialChunks,omitempty"`
Collation options.Collation `bson:"collation,omitempty"`
}
ShardingConfig struct that holds information to shard the collection
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
Package generators used to create bson encoded random data.
|
Package generators used to create bson encoded random data. |
Click to show internal directories.
Click to hide internal directories.