Class: Mongrep::MongoModel Abstract

Inherits:
Object
  • Object
show all
Includes:
Abstractize, Model
Defined in:
lib/mongrep/mongo_model.rb

Overview

This class is abstract.

The base class for all models

Instance Method Summary collapse

Methods included from Model

partial

Methods included from Mongrep::Model::VirtusExtensions

#==, #to_h

Instance Method Details

#bson_typeObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Used by Mongo to convert the model into BSON



22
23
24
# File 'lib/mongrep/mongo_model.rb', line 22

def bson_type
  Hash::BSON_TYPE
end

#idObject

An alias for #_id



16
17
18
# File 'lib/mongrep/mongo_model.rb', line 16

def id
  _id
end

#to_bson(*args) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Used by Mongo to convert the model into BSON



28
29
30
# File 'lib/mongrep/mongo_model.rb', line 28

def to_bson(*args)
  to_h.to_bson(*args)
end