Method: Mongo::Operation::Insert::Result#inserted_id

Defined in:
lib/mongo/operation/insert/result.rb

#inserted_idObject

Gets the id of the document inserted.

Examples:

Get id of the document inserted.

result.inserted_id

Returns:

  • (Object)

    The id of the document inserted.

Since:

  • 2.0.0



64
65
66
# File 'lib/mongo/operation/insert/result.rb', line 64

def inserted_id
  inserted_ids.first
end