Module: Arango::DocumentCollection::Documents

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

Overview

Arango DocumentCollection Documents

Instance Method Summary collapse

Instance Method Details

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



34
35
36
# File 'lib/arango/document_collection/documents.rb', line 34

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



10
11
12
# File 'lib/arango/document_collection/documents.rb', line 10

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



14
15
16
# File 'lib/arango/document_collection/documents.rb', line 14

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



61
62
63
# File 'lib/arango/document_collection/documents.rb', line 61

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

#delete_documents(documents_array) ⇒ Object



65
66
67
# File 'lib/arango/document_collection/documents.rb', line 65

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)


18
19
20
# File 'lib/arango/document_collection/documents.rb', line 18

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



22
23
24
# File 'lib/arango/document_collection/documents.rb', line 22

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



28
29
30
# File 'lib/arango/document_collection/documents.rb', line 28

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

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



38
39
40
# File 'lib/arango/document_collection/documents.rb', line 38

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



6
7
8
# File 'lib/arango/document_collection/documents.rb', line 6

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



42
43
44
# File 'lib/arango/document_collection/documents.rb', line 42

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



46
47
48
49
# File 'lib/arango/document_collection/documents.rb', line 46

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



51
52
53
# File 'lib/arango/document_collection/documents.rb', line 51

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



56
57
58
# File 'lib/arango/document_collection/documents.rb', line 56

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