diff --git a/ThinkPHP/Library/Think/Db/Driver/Mongo.class.php b/ThinkPHP/Library/Think/Db/Driver/Mongo.class.php index 8fe879142..299097111 100644 --- a/ThinkPHP/Library/Think/Db/Driver/Mongo.class.php +++ b/ThinkPHP/Library/Think/Db/Driver/Mongo.class.php @@ -270,8 +270,11 @@ public function insertAll($dataList, $options = array()) * @param string $pk 主键名 * @return integer */ - public function getMongoNextId($pk) + public function getMongoNextId($pk,$options=array()) { + if (isset($options['table'])) { + $this->switchCollection($options['table']); + } if ($this->config['debug']) { $this->queryStr = $this->_dbName . '.' . $this->_collectionName . '.find({},{' . $pk . ':1}).sort({' . $pk . ':-1}).limit(1)'; }