Documentation ¶
Overview ¶
Package mongofiles provides an interface to GridFS collections in a MongoDB instance.
Index ¶
Constants ¶
View Source
const ( List = "list" Search = "search" Put = "put" Get = "get" GetID = "get_id" Delete = "delete" DeleteID = "delete_id" )
List of possible commands for mongofiles.
Variables ¶
View Source
var Usage = `` /* 642-byte string literal not displayed */
Functions ¶
This section is empty.
Types ¶
type GFSFile ¶
type GFSFile struct { Id bson.ObjectId `bson:"_id"` ChunkSize int `bson:"chunkSize"` Name string `bson:"filename"` Length int64 `bson:"length"` Md5 string `bson:"md5"` UploadDate time.Time `bson:"uploadDate"` ContentType string `bson:"contentType,omitempty"` }
GFSFile represents a GridFS file.
type MongoFiles ¶
type MongoFiles struct { // generic mongo tool options ToolOptions *options.ToolOptions // mongofiles-specific storage options StorageOptions *StorageOptions // for connecting to the db SessionProvider *db.SessionProvider // command to run Command string // filename in GridFS FileName string }
MongoFiles is a container for the user-specified options and internal state used for running mongofiles.
func (*MongoFiles) Run ¶
func (mf *MongoFiles) Run(displayHost bool) (string, error)
Run the mongofiles utility. If displayHost is true, the connected host/port is displayed.
func (*MongoFiles) ValidateCommand ¶
func (mf *MongoFiles) ValidateCommand(args []string) error
ValidateCommand ensures the arguments supplied are valid.
type StorageOptions ¶
type StorageOptions struct { // Specified database to use. defaults to 'test' if none is specified DB string `short:"d" default:"test" default-mask:"-" long:"db" description:"database to use (default is 'test')"` // 'LocalFileName' is an option that specifies what filename to use for (put|get) LocalFileName string `long:"local" short:"l" description:"local filename for put|get"` // 'ContentType' is an option that specifies the Content/MIME type to use for 'put' ContentType string `long:"type" short:"t" description:"content/MIME type for put (optional)"` // if set, 'Replace' will remove other files with same name after 'put' Replace bool `long:"replace" short:"r" description:"remove other files with same name after put"` // GridFSPrefix specifies what GridFS prefix to use; defaults to 'fs' GridFSPrefix string `long:"prefix" default:"fs" default-mask:"-" description:"GridFS prefix to use (default is 'fs')"` // Specifies the write concern for each write operation that mongofiles writes to the target database. // By default, mongofiles waits for a majority of members from the replica set to respond before returning. WriteConcern string `` /* 207-byte string literal not displayed */ }
StorageOptions defines the set of options to use in storing/retrieving data from server.
func (*StorageOptions) Name ¶
func (_ *StorageOptions) Name() string
Name returns a human-readable group name for storage options.
Click to show internal directories.
Click to hide internal directories.