mongo

package
v0.1.0-alpha.3 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2022 License: MIT Imports: 16 Imported by: 0

README

Package mongo

Package mongo provides a driver to work with the MongoDB DBMS.

Authentication configuration

See the package reference for details.

Documentation

Overview

Package mongo provides a driver to work with the Mongo DBMS.

Authentication configuration

DFI components which use MongoDB server that requires authentication must provide authentication data (user, password, method, etc.). This is done using component-specific configuration files. In general, these files contain a section with MongoDB-specific authentication data in a common format represented as JSON object.

For example, to authenticate using SCRAM-SHA-1 you must provide the following object:

{
    "AuthMechanism": "SCRAM-SHA-1",
    "Username": "USER-NAME",
    "Password": "USER-PASSWORD"
}

See the component's README file, the official reference, and the Go-example.

Index

Constants

View Source
const (
	MongoFieldTFPath = "tfpath"
	MongoFieldTName  = "tname"
)

Duplicates of original fields found path and name with values transformed for tokenization

View Source
const (
	MongoFieldID  = "_" + dbms.FieldID
	MongoObjsColl = "objs"
	MongoAIIColl  = "aii"
)

Variables

This section is empty.

Functions

func DisableStartupPing

func DisableStartupPing()

Types

type Client

type Client struct {
	*dbms.CommonClient
	// contains filtered or unexported fields
}

func NewClient

func NewClient(dbCfg *dbms.DBConfig) (*Client, error)

func (*Client) Commit

func (mc *Client) Commit() (int64, int64, error)

func (*Client) DeleteFPathPref

func (mc *Client) DeleteFPathPref(fso *types.FSObject) (int64, error)

func (*Client) DeleteObj

func (mc *Client) DeleteObj(fso *types.FSObject) error

func (*Client) GetAIIIds

func (mc *Client) GetAIIIds(withFields []string) ([]string, error)

func (*Client) GetAIIs

func (mc *Client) GetAIIs(ids, retFields []string) (dbms.QueryResultsAII, error)

func (*Client) GetObjects

func (mc *Client) GetObjects(ids, retFields []string) (dbms.QueryResults, error)

func (*Client) LoadHostPaths

func (mc *Client) LoadHostPaths(match dbms.MatchStrFunc) ([]string, error)

func (*Client) ModifyAII

func (mc *Client) ModifyAII(op dbms.DBOperator, args *dbms.AIIArgs, ids []string, add bool) (int64, int64, error)

func (*Client) Query

func (mc *Client) Query(qa *dbms.QueryArgs, retFields []string) (dbms.QueryResults, error)

func (*Client) QueryAIIIds

func (mc *Client) QueryAIIIds(qa *dbms.QueryArgs) ([]string, error)

func (*Client) UpdateObj

func (mc *Client) UpdateObj(fso *types.FSObject) error

type Filter

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

func NewFilter

func NewFilter() *Filter

func (*Filter) Append

func (f *Filter) Append(expr ...primitive.E) *Filter

func (*Filter) Clone

func (f *Filter) Clone() *Filter

func (*Filter) Expr

func (f *Filter) Expr() bson.D

func (*Filter) FullText

func (f *Filter) FullText() bool

func (*Filter) JoinByNor

func (f *Filter) JoinByNor() *Filter

func (*Filter) JoinByOr

func (f *Filter) JoinByOr() *Filter

func (*Filter) JoinWithOthers

func (f *Filter) JoinWithOthers(qjt queryJoinType, filters ...*Filter) *Filter

func (*Filter) Len

func (f *Filter) Len() int

func (*Filter) NegFilter

func (f *Filter) NegFilter() *Filter

NegFilter converts list of filter conditions from:

{ { $cond1 }, { $cond2 }, { $cond3 } }

to:

{$not: $cond1 }, {$not: $cond2 }, {$not: $cond3}

but (!) Mongo does not support $not as the first-level operator, need to use $nor

{ {$nor: [{ $cond1 }] }, {$nor: [{ $cond2 }], {$nor: [{ $cond3 }]} }

func (*Filter) SetExpr

func (f *Filter) SetExpr(expr primitive.D) *Filter

func (*Filter) SetFullText

func (f *Filter) SetFullText() *Filter

Jump to

Keyboard shortcuts

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