0 Star 1 Fork 0

蒋佳李 / leaf

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
database.go 583 Bytes
一键复制 编辑 原始数据 按行查看 历史
蒋佳李 提交于 2023-02-25 21:23 . 修复数据和BUG
package db
import (
"context"
"go.mongodb.org/mongo-driver/mongo"
"go.mongodb.org/mongo-driver/mongo/options"
)
// Database mongo-driver database
type Database struct {
database *mongo.Database
}
// CollectionNames 返回数据库中存在的所有集合名称
func (d *Database) CollectionNames() (names []string, err error) {
names, err = d.database.ListCollectionNames(context.TODO(), options.ListCollectionsOptions{})
return
}
// C 返回集合
func (d *Database) C(collection string) *Collection {
return &Collection{collection: d.database.Collection(collection)}
}
Go
1
https://gitee.com/jiangjiali/leaf.git
git@gitee.com:jiangjiali/leaf.git
jiangjiali
leaf
leaf
v1.1.44

搜索帮助

53164aa7 5694891 3bd8fe86 5694891