首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >如何使用Jongo运行特定的命令?

如何使用Jongo运行特定的命令?
EN

Stack Overflow用户
提问于 2014-06-25 12:39:06
回答 1查看 351关注 0票数 0

我使用TokuMx来组织事务。它有特定的命令来这样做。

我试图运行db.runCommand("beginTransaction") in Mongo shell。效果很好。

然而,当我在Jongo中做同样的事情时:

PlayJongo.jongo().runCommand("beginTransaction");

它给了我[error] play - Cannot invoke the action, eventually got an error: java.lang.IllegalArgumentException: Cannot parse query: beginTransaction

我做错什么了?

编辑

代码语言:javascript
复制
public static boolean buyProduct(User buyer, User seller, int accountIndex, float productPrice){
    boolean isSuccess = false;
    PlayJongo.jongo().runCommand("{beginTransaction : 1}");
    try{
        // Deposit money to seller
        seller.getAccounts().get(0).deposit(productPrice);
        UserRepository.update(seller);
        // Withdraw money from buyer
        buyer.getAccounts().get(accountIndex).withdraw(productPrice);
        UserRepository.update(buyer);
        throw new Exception();
        //isSuccess = true;
    }
    catch (Exception e){
        PlayJongo.jongo().runCommand("{rollbackTransaction : 1 }");
        isSuccess = false;
    }

    return isSuccess;
}
EN

回答 1

Stack Overflow用户

发布于 2014-06-25 17:13:43

我不是jongo专家,但我做托卡姆的工作,我只是检查了jongo的文档。我想你想

代码语言:javascript
复制
PlayJongo.jongo().runCommand("{beginTransaction:1}");
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24408924

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档