data_mongodb

package module
v0.28.0 Latest Latest
Warning

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

Go to latest
Published: May 20, 2026 License: MIT Imports: 18 Imported by: 0

README

data-mongodb

data-mongodbgithub.com/infrago/datamongodb 驱动

包定位

  • 类型:驱动
  • 作用:把 data 模块的统一接口落到 mongodb 后端实现

快速接入

import (
    _ "github.com/infrago/data"
    _ "github.com/infrago/data-mongodb"
)
[data]
driver = "mongodb"

setting 专用配置项

配置位置:[data].setting

  • dsn
  • database
  • indexes
  • cache
  • errorMode

说明

  • setting 仅对当前驱动生效,不同驱动键名可能不同
  • 连接失败时优先核对 setting 中 host/port/认证/超时等参数

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregateRaw added in v0.7.0

func AggregateRaw(db data.DataBase, collection string, pipeline Any) []Map

func Command added in v0.7.0

func Command(db data.DataBase, cmd Any) Map

func Driver

func Driver() data.Driver

func EnsureMongoDriver added in v0.7.0

func EnsureMongoDriver(db data.DataBase) error

func FindRaw added in v0.7.0

func FindRaw(db data.DataBase, collection string, filter Any, opts ...Map) []Map

Types

type RawExecutor added in v0.7.0

type RawExecutor interface {
	Command(Any) Map
	FindRaw(string, Any, ...Map) []Map
	AggregateRaw(string, Any) []Map
}

func AsRawExecutor added in v0.7.0

func AsRawExecutor(db data.DataBase) (RawExecutor, bool)

Jump to

Keyboard shortcuts

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