Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mongodb加入事务支持,需要mongodb版本V4.0以上且开启复制集或分布式 #98

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

klinson
Copy link

@klinson klinson commented Dec 23, 2019

需要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();
});

需要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();
});
```
@klinson
Copy link
Author

klinson commented May 9, 2020

@liu21st 麻烦合并

@yunwuxin
Copy link
Member

yunwuxin commented May 9, 2020

既然有版本限制 那就需要做一下低版本的兼容 还有属性命名不规范

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants