think-mongo icon indicating copy to clipboard operation
think-mongo copied to clipboard

mongodb driver for thinkphp

Results 25 think-mongo issues
Sort by recently updated
recently updated
newest added

php 版本8.1 thinkphp 版本8 系统提示 Your requirements could not be resolved to an installable set of packages. Problem 1 - Root composer.json requires topthink/think-mongo ^3.0 -> satisfiable by topthink/think-mongo[v3.0.0, ...,...

代码: ![image](https://user-images.githubusercontent.com/29562676/86784537-35e34100-c094-11ea-8fd4-670da4f33656.png) 报错: ![image](https://user-images.githubusercontent.com/29562676/86784575-41cf0300-c094-11ea-8b98-16376791ad78.png) 这下面的传参被强制类型了,然后这个我把强制类型去掉,这个传的是null,然后死循环开始,我如何从当前获取这个对象 ![image](https://user-images.githubusercontent.com/29562676/86784680-61662b80-c094-11ea-8fe6-08f6d4b15e3e.png)

需要mongodb版本V4以上且开启复制集或分布式 事务内支持insert、update、delete、cmd等操作方式 支持无限级嵌套事务,但是外围事务回滚不影响内部事务的commit ``` Db::transaction(function () { db()->table('users')->insert(['username' => 'test80']); Db::startTrans(); db()->table('users')->where(['username' => 'test84'])->update(['sex' => 4]); Db::commit(); }); ```

2009行. $result = $this->table($tableName)->find(); if ($result instanceof Model) { $result = $result->toArray(); } $fields = array_keys($result); 当集合中数据为空时,$result为null, 导致array_keys($result);抛出异常array_keys() expects parameter 1 to be array, null given 希望修复

用mongo子账号在客户端可以连接到某个db的,所以权限没问题的,同样的问题在以下链接看到了 [tp5 mongodb Authentication failed(认证失败)](http://www.thinkphp.cn/bug/4731.html) 建议`connector/Mongo.php` 135行`dsn`增加`database`的配置 修改前: ``` $config['dsn'] = 'mongodb://' . ($config['username'] ? "{$config['username']}" : '') . ($config['password'] ? ":{$config['password']}@" : '') . $config['hostname'] . ($config['hostport'] ? ":{$config['hostport']}"...

查询坐标的时候报错 `in Builder.php line 202 at Error::appError(8, 'Undefined offset: 1', 'D:\xxx\xxx\simple...', 202, ['field' => 'coordinates', 'val' => ['$near' => ['$geometry' => ['type' => 'Point', 'coordinates' => [114.413696, 30.492449]], '$maxDistance' =>...

UnexpectedValueException in Connection.php line 341 ,Detected corrupt BSON data

我用的是ThinkPHP5.0.22. 我在extra目录下建立了一个文件叫`mongo.php`内容如下 ```php return [ 'type' => '\think\mongo\Connection', 'hostname' => '1.2.3.4', 'database' => 'fa_brand', 'username' => 'mongodb', 'password' => 'pre-mongodb', 'hostport' => '2000', 'prefix' => '', 'pk_convert_id' => true, 'debug'...

Call Stack in Connection.php line 291 at Manager->executeQuery('mdb_mid_m2.m2_mid', object( Query), null) in Connection.php line 291 at Connection->query('mdb_mid_m2.m2_mid', object( Query), null, false, ['root' => 'array', 'document' => 'array']) in Query.php line...