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

golang mgo.v2 处理 mongodb 的多个数据时如何实现 continue_on_error

  •  
  •   neargle ·
    neargle · Nov 16, 2017 · 2115 views
    This topic created in 3104 days ago, the information mentioned may be changed or developed.

    mgo.v2 拥有一些如

    func (c *Collection) RemoveAll(selector interface{})
    

    func (c *Collection) UpdateAll(selector interface{}, update interface{})
    

    这类型的函数, 当我们使用这些函数更新多条数据的时候,有可能单个数据会产生错误,这时候,我们希望它忽略这个错误,继续处理接下来的数据。该如何实现呢?

    如:pymongo 里的 orderedcontinue_on_error

    看了文档,google 了一下好像没有合适的方法。

    1 replies    2017-11-16 18:35:33 +08:00
    jameshuazhou
        1
    jameshuazhou  
       Nov 16, 2017
    改源码啊,照着 pymongo 改就好了。
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   1589 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 126ms · UTC 16:23 · PVG 00:23 · LAX 09:23 · JFK 12:23
    ♥ Do have faith in what you're doing.