代码之家  ›  专栏  ›  技术社区  ›  user1063287

当从3.2.7更新到4.1.4时,是否有一个与MongoDB节点本机驱动程序的中断更改相关的可操作项目的明确列表?

  •  0
  • user1063287  · 技术社区  · 3 年前

    我已经从升级了MongoDB Node本机驱动程序 3.2.7 4.1.4 .

    我一次只发现一个错误的含义,并调整两个服务器端代码(例如,现在为以下内容返回不同的属性 insertOne updateOne )以及前端代码,这些代码也依赖于这些返回的属性来对结果进行条件处理。

    我在这里参考了官方升级指南:

    https://github.com/mongodb/node-mongodb-native/blob/HEAD/docs/CHANGES_4.0.0.md

    其中提到:

    我们的CRUD操作现在返回符合驱动程序范围规范的结果,这些结果在此处定义:
    CRUD SPEC Write Results

    那个链接 似乎 以提供有关结果类别的一般信息,我还无法将这些信息映射到我使用的相关节点本机驱动程序方法。

    有人能提出一种有条不紊的方法来遍历大量代码(约10000行)并更新相关方法吗?

    是否有一份明确的受影响方法清单?

    这样我就可以在代码中搜索每个受影响的方法并进行相应的更新?

    作为参考,我还查看了此处的变更日志:

    https://github.com/mongodb/node-mongodb-native/blob/4.0/HISTORY.md

    并搜索 'breaking' ,但是,我无法将列出的内容转化为我可以执行的可操作项目:

    4.0.0-beta.6 (2021-07-01)
    ⚠ BREAKING CHANGES
    NODE-3291: Standardize error representation in the driver (#2824)
    NODE-3272: emit correct event type when SRV Polling (#2825)
    remove strict/callback mode from Db.collection helper (#2817)
    
    4.0.0-beta.4 (2021-05-18)
    ⚠ BREAKING CHANGES
    NODE-1812: replace returnOriginal with returnDocument option (#2803)
    NODE-3157: update find and modify interfaces for 4.0 (#2799)
    NODE-2978: remove deprecated bulk ops (#2794)
    
    4.0.0-beta.2 (2021-03-16)
    ⚠ BREAKING CHANGES
    remove deprecated items (#2740)
    remove enums in favor of const objects (#2741)
    
    4.0.0-beta.0 (2021-01-19)
    ⚠ BREAKING CHANGES
    Clarify empty BulkOperation error message (#2697)
    db: suppress Db events (#2251)
    Integrate MongoOptions parser into driver (#2680)
    bulk: add collation to FindOperators (#2679)
    remove top-level write concern options (#2642)
    CreateIndexOp returns string, CreateIndexesOp returns array (#2666)
    conform CRUD result types to specification (#2651)
    remove deprecated Collection.group helper
    Options object precedence over URI options (#2691)
    adds async iterator for custom promises
    format sort in cursor and in sort builder (#2573)
    remove Cursor#transformStream
    remove deprecated find options
    pull CursorStream out of Cursor
    remove deprecated GridFS API
    only store topology on MongoClient (#2594)
    

    大声思考,这只是在我的代码中搜索的所有实例的问题吗 collection. 然后检查每个附加方法的文档,即:

    方法 3.2文件 4.1文件
    deleteOne link link
    发现 link link
    findOne link link
    findOneAndUpdate link link
    insertOne link link
    updateMany link link
    updateOne link link
    0 回复  |  直到 3 年前