Hacktoberfest 2026:维护者为十月标记出来的 issue,仍然开放、适合新手。 浏览 Hacktoberfest issue

Mongo 3 + Mongoid 5 Compatibility

未关闭
#2 25 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

还没有人认领这个 Issue。

评估

难度
4/5
预计耗时
3-5 天
新手友好度
25/100
Issue 类型
缺陷
描述清晰度
基本清楚
活跃度
停滞
技术栈
mongodb, ruby
领域
databases

调研方向

从当前 master 中的 Mongo 2 truncation mixin 开始,将其 collection lookup 与此处描述的 Mongo 3 方案进行比较。检查 pull requests #343 和 #349、issue #386 以及所引用的 commit,以确定 Mongo 2 和 Mongoid 5 的兼容性应如何共存。完成的标准是 Mongo 3 加 Mongoid 5 的情况能够正常工作,同时不破坏对 Mongo 2 的支持。

由索引模型根据 Issue 内容生成。

描述

The pull request from DatabaseCleaner/database_cleaner#343 fixes compatibility with Mongo 3 but doesn't address the problem of Mongo 3 + Mongoid 5.

In the current master, the Mongo 2 truncation mixin contains this:

database['system.namespaces'].find(:name => { '$not' => /\.system\.|\$/ }).to_a.map do |collection|
  _, name = collection['name'].split('.', 2)
  name
end

And this commit won't work with mongo v3. Instead, I've found this to work:

session.command(listCollections: 1).first[:cursor][:firstBatch].map do |collection|
    collection[:name]
...

Plus, you also need the sessions function, also excluded:

def session
  ::Mongoid.default_session
end

But that won't work with Mongo 2 I don't believe.

What is the plan for Mongo3 - do you want me to merge this in to a separate module or have you already dealt with?

It seems this has been covered but not for Mongoid 5.

https://github.com/DatabaseCleaner/database_cleaner/pull/343
https://github.com/DatabaseCleaner/database_cleaner/pull/349
https://github.com/andreale/database_cleaner/commit/e9b2c8cd5d335006b8a59e2a89cdbd3fb9e5a23d
https://github.com/DatabaseCleaner/database_cleaner/issues/386

主要语言
Ruby
星标
9
派生
7
PR 合并指标
30 天内没有已合并 PR

贡献指南

这个仓库没有索引到贡献指南

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

DatabaseCleaner/database_cleaner-mongoid 的其他 Issue

查看 DatabaseCleaner/database_cleaner-mongoid 的全部 Issue

相似的 Issue

更多 Ruby Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。