在哪里可以找到 Mongoid class 的特定文档?

Where can I find a specific documentation for a Mongoid class?

我是 Mongoid 的新手,我想了解更多。今天我在 here 中遇到了 Mongoid::Timestamps

我觉得它很有趣,所以我想了解更多,但找不到更多关于 Mongoid::Timestamps 的文档。我目前尝试在 Class 列表、方法列表和文件列表中搜索 here,但没有找到任何内容。

似乎 Mongoid 的文档非常有限。

您可以 read its RubyDoc 找到更多关于 Mongoid::Timestamps 的信息。没什么特别的,但 简而言之:

Including Mongoid::Timestamps in your Ruby model classes would tell MongoDB to save timestamps of when a document was created or updated. This creates two new attributes in your model:

  • created_at
  • updated_at

你这样使用它:

class User
  include Mongoid::Document
  include Mongoid::Timestamps

  # Other stuff...
end