Skip to content

操作MongoDB使用execute ($collection, $bulk)报错,这个方法貌似连参数都没有定义对 #819

@idamon

Description

@idamon

官网定义原生执行操作MongoDB的文档如下

execute ($collection, $bulk)
collection:表示当前查询的集合
bulk:是一个\MongoDB\Driver\BulkWrite对象


以下是测试代码

$data = [
            'name' => 'Tome',
           'age' => 20
];

$bulk = new \MongoDB\Driver\BulkWrite();
$bulk->insert($data);

Db::execute('demo', $bulk);

返回错误信息:
message: think\db\connector\Mongo::execute(): Argument #1 ($bulk) must be of type MongoDB\Driver\BulkWrite, string given
file: vendor/topthink/think-orm/src/db/connector/Mongo.php
line: 316

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions