The Go Programming Language
http://golang.org/
Go Playground
Go Projects
Revel Web Framework
harry890829

mgo 条件修改 mongodb

  •  
  •   harry890829 · Jul 7, 2017 · 1531 views
    This topic created in 3284 days ago, the information mentioned may be changed or developed.

    在使用 mgo 修改数据库中谋个字段可以直接使用$set

    现在遇到一个情况,比如我想当 a 的值为 1 时,才更改 a 的值,是不是一定要走一遍查询拿出来后,再使用$set 把值改变么?

    3 replies    2017-07-07 18:14:32 +08:00
    harry890829
        3
    harry890829  
    OP
       Jul 7, 2017
    @cxbig #1
    @JackeyGao #2
    脑子有点秀逗了,发完后我想了想,问题有点蠢……我前两天还自己还用过这个功能
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   2823 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 44ms · UTC 10:11 · PVG 18:11 · LAX 03:11 · JFK 06:11
    ♥ Do have faith in what you're doing.