mongo模型库save更新报错

Open
#177 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
35/100
Issue type
Bug
Clarity
Needs clarification
Activity status
Stale
Tech stack
mongodb, php
Domain
database

Research direction

Start at topthink/think-orm/db/connector/Mongo.php line 383 and reproduce the save operation against the reported MongoDB 3.6 standalone setup. Determine why the transaction error occurs during save; done means the shown update completes without that error, with the relevant behavior covered or documented.

Written by the indexing model from the issue text.

Description

MongoDb
$file = \app\common\mongo\FileInfo::where('fileid',$fileId)->find();
$file['update_time'] = date('Y-m-d H:m:s');
$file->save();

报错了

topthink/think-orm/db/connector/Mongo.php line 383

Transaction numbers are only allowed on a replica set member or mongos

我的mongo版本是3.6,就一个mongo库
请问遇到这问题该怎么解决呢

Dominant language
PHP
Stars
437
Forks
188
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from top-think/think-orm

All issues in top-think/think-orm

Similar issues

More PHP issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.