Module: Arango::DocumentCollection::Documents

Defined in:
lib/arango/document_collection/documents.rb

Instance Method Summary collapse

Instance Method Details

#all_documents(offset: 0, limit: nil, batch_size: nil) ⇒ Object



32
33
34
# File 'lib/arango/document_collection/documents.rb', line 32

def all_documents(offset: 0, limit: nil, batch_size: nil)
  Arango::Document::Base.all(offset: offset, limit: limit, batch_size: batch_size, collection: self)
end

#create_document(key: nil, attributes: {}, wait_for_sync: nil) ⇒ Object



8
9
10
# File 'lib/arango/document_collection/documents.rb', line 8

def create_document(key: nil, attributes: {}, wait_for_sync: nil)
  Arango::Document::Base.new(key: key, attributes: attributes, collection: self, wait_for_sync: wait_for_sync).create
end

#create_documents(array_of_attributes_hashes, wait_for_sync: nil) ⇒ Object



12
13
14
# File 'lib/arango/document_collection/documents.rb', line 12

def create_documents(array_of_attributes_hashes, wait_for_sync: nil)
  Arango::Document::Base.create_documents(array_of_attributes_hashes, collection: self, wait_for_sync: wait_for_sync)
end

#delete_document(key: nil, attributes: {}) ⇒ Object



59
60
61
# File 'lib/arango/document_collection/documents.rb', line 59

def delete_document(key: nil, attributes: {})
  Arango::Document::Base.delete(key: key, attributes: attributes, collection: self)
end

#delete_documents(documents_array) ⇒ Object



63
64
65
# File 'lib/arango/document_collection/documents.rb', line 63

def delete_documents(documents_array)
  Arango::Document::Base.delete_documents(documents_array, collection: self)
end

#document_exists?(key: nil, attributes: {}, match_rev: nil) ⇒ Boolean

Returns:

  • (Boolean)


16
17
18
# File 'lib/arango/document_collection/documents.rb', line 16

def document_exists?(key: nil, attributes: {}, match_rev: nil)
  Arango::Document::Base.exists?(key: key, attributes: attributes, match_rev: match_rev, collection: self)
end

#get_document(key: nil, attributes: {}) ⇒ Object Also known as: fetch_document, retrieve_document



20
21
22
# File 'lib/arango/document_collection/documents.rb', line 20

def get_document(key: nil, attributes: {})
  Arango::Document::Base.get(key: key, attributes: attributes, collection: self)
end

#get_documents(keys) ⇒ Object Also known as: fetch_documents, retrieve_documents



26
27
28
# File 'lib/arango/document_collection/documents.rb', line 26

def get_documents(keys)
  Arango::Document::Base.get_documents(keys, collection: self)
end

#list_documents(offset: 0, limit: nil, batch_size: nil) ⇒ Object



36
37
38
# File 'lib/arango/document_collection/documents.rb', line 36

def list_documents(offset: 0, limit: nil, batch_size: nil)
  Arango::Document::Base.list(offset: offset, limit: limit, batch_size: batch_size, collection: self)
end

#new_document(key: nil, attributes: {}, wait_for_sync: nil) ⇒ Object



4
5
6
# File 'lib/arango/document_collection/documents.rb', line 4

def new_document(key: nil, attributes: {}, wait_for_sync: nil)
  Arango::Document::Base.new(key: key, attributes: attributes, collection: self, wait_for_sync: wait_for_sync)
end

#replace_document(document) ⇒ Object



40
41
42
# File 'lib/arango/document_collection/documents.rb', line 40

def replace_document(document)
  Arango::Document::Base.replace(document)
end

#replace_documents(documents_array, wait_for_sync: nil, ignore_revs: nil, return_old: nil, return_new: nil) ⇒ Object



44
45
46
47
# File 'lib/arango/document_collection/documents.rb', line 44

def replace_documents(documents_array, wait_for_sync: nil, ignore_revs: nil, return_old: nil, return_new: nil)
  Arango::Document::Base.replace_documents(documents_array, wait_for_sync: wait_for_sync, ignore_revs: ignore_revs,
                                           return_old: return_old, return_new: return_new)
end

#save_document(document) ⇒ Object Also known as: update_document



49
50
51
# File 'lib/arango/document_collection/documents.rb', line 49

def save_document(document)
  Arango::Document::Base.save(document)
end

#save_documents(documents_array, wait_for_sync: nil, ignore_revs: nil) ⇒ Object Also known as: update_documents



54
55
56
# File 'lib/arango/document_collection/documents.rb', line 54

def save_documents(documents_array, wait_for_sync: nil, ignore_revs: nil)
  Arango::Document::Base.save_documents(documents_array, wait_for_sync: wait_for_sync, ignore_revs: ignore_revs)
end