diff --git a/src/main/java/com/arangodb/ArangoCollection.java b/src/main/java/com/arangodb/ArangoCollection.java
index d0c7d31f5..86c42cbb1 100644
--- a/src/main/java/com/arangodb/ArangoCollection.java
+++ b/src/main/java/com/arangodb/ArangoCollection.java
@@ -22,6 +22,7 @@
import com.arangodb.entity.*;
import com.arangodb.model.*;
+import com.arangodb.util.RawData;
import java.util.Collection;
@@ -54,8 +55,7 @@ public interface ArangoCollection extends ArangoSerdeAccessor {
* Creates a new document from the given document, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData}
* @return information about the document
* @see API
* Documentation
@@ -66,8 +66,7 @@ public interface ArangoCollection extends ArangoSerdeAccessor {
* Creates a new document from the given document, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @return information about the document
* @see API
@@ -79,8 +78,7 @@ public interface ArangoCollection extends ArangoSerdeAccessor {
* Creates a new document from the given document, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @param type Deserialization target type for the returned documents.
* @return information about the document
@@ -93,7 +91,31 @@ public interface ArangoCollection extends ArangoSerdeAccessor {
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
+ * @param values Raw data representing a collection of documents
+ * @return information about the documents
+ * @see API
+ * Documentation
+ */
+ MultiDocumentEntity> insertDocuments(RawData values);
+
+ /**
+ * Creates new documents from the given documents, unless there is already a document with the _key given. If no
+ * _key is given, a new unique _key is generated automatically.
+ *
+ * @param values Raw data representing a collection of documents
+ * @param options Additional options
+ * @return information about the documents
+ * @see API
+ * Documentation
+ */
+ MultiDocumentEntity> insertDocuments(
+ RawData values, DocumentCreateOptions options);
+
+ /**
+ * Creates new documents from the given documents, unless there is already a document with the _key given. If no
+ * _key is given, a new unique _key is generated automatically.
+ *
+ * @param values A List of documents
* @return information about the documents
* @see API
* Documentation
@@ -104,8 +126,7 @@ public interface ArangoCollection extends ArangoSerdeAccessor {
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @return information about the documents
* @see API
@@ -118,8 +139,7 @@ MultiDocumentEntity> insertDocuments(
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @param type Deserialization target type for the returned documents.
* @return information about the documents
@@ -132,7 +152,7 @@ MultiDocumentEntity> insertDocuments(
/**
* Bulk imports the given values into the collection.
*
- * @param values a list of Objects that will be stored as documents
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @return information about the import
*/
DocumentImportEntity importDocuments(Collection> values);
@@ -140,7 +160,7 @@ MultiDocumentEntity> insertDocuments(
/**
* Bulk imports the given values into the collection.
*
- * @param values a list of Objects that will be stored as documents
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return information about the import
*/
@@ -149,26 +169,25 @@ MultiDocumentEntity> insertDocuments(
/**
* Bulk imports the given values into the collection.
*
- * @param values JSON-encoded array of objects that will be stored as documents
+ * @param values Raw data representing a collection of documents
* @return information about the import
*/
- DocumentImportEntity importDocuments(String values);
+ DocumentImportEntity importDocuments(RawData values);
/**
* Bulk imports the given values into the collection.
*
- * @param values JSON-encoded array of objects that will be stored as documents
+ * @param values Raw data representing a collection of documents
* @param options Additional options, can be null
* @return information about the import
*/
- DocumentImportEntity importDocuments(String values, DocumentImportOptions options);
+ DocumentImportEntity importDocuments(RawData values, DocumentImportOptions options);
/**
* Retrieves the document with the given {@code key} from the collection.
*
* @param key The key of the document
- * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the document (POJO or {@link com.arangodb.util.RawData})
* @return the document identified by the key
* @see API
* Documentation
@@ -179,8 +198,7 @@ MultiDocumentEntity> insertDocuments(
* Retrieves the document with the given {@code key} from the collection.
*
* @param key The key of the document
- * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return the document identified by the key
* @see API
@@ -192,8 +210,7 @@ MultiDocumentEntity> insertDocuments(
* Retrieves multiple documents with the given {@code _key} from the collection.
*
* @param keys The keys of the documents
- * @param type The type of the documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the documents (POJO or {@link com.arangodb.util.RawData})
* @return the documents and possible errors
*/
MultiDocumentEntity getDocuments(Collection keys, Class type);
@@ -202,8 +219,7 @@ MultiDocumentEntity> insertDocuments(
* Retrieves multiple documents with the given {@code _key} from the collection.
*
* @param keys The keys of the documents
- * @param type The type of the documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return the documents and possible errors
*/
@@ -214,8 +230,7 @@ MultiDocumentEntity> insertDocuments(
* precondition is violated
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @return information about the document
* @see
* API
@@ -228,8 +243,7 @@ MultiDocumentEntity> insertDocuments(
* precondition is violated
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @return information about the document
* @see
@@ -243,8 +257,7 @@ MultiDocumentEntity> insertDocuments(
* precondition is violated
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @param type Deserialization target type for the returned documents.
* @return information about the document
@@ -258,7 +271,33 @@ MultiDocumentEntity> insertDocuments(
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
* specified by the _key attributes in the documents in values.
*
- * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
+ * @param values Raw data representing a collection of documents
+ * @return information about the documents
+ * @see
+ * API
+ * Documentation
+ */
+ MultiDocumentEntity> replaceDocuments(RawData values);
+
+ /**
+ * Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
+ * specified by the _key attributes in the documents in values.
+ *
+ * @param values Raw data representing a collection of documents
+ * @param options Additional options
+ * @return information about the documents
+ * @see
+ * API
+ * Documentation
+ */
+ MultiDocumentEntity> replaceDocuments(
+ RawData values, DocumentReplaceOptions options);
+
+ /**
+ * Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
+ * specified by the _key attributes in the documents in values.
+ *
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @return information about the documents
* @see
* API
@@ -270,8 +309,7 @@ MultiDocumentEntity> insertDocuments(
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
* specified by the _key attributes in the documents in values.
*
- * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @return information about the documents
* @see
@@ -285,8 +323,7 @@ MultiDocumentEntity> replaceDocuments(
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
* specified by the _key attributes in the documents in values.
*
- * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @param type Deserialization target type for the returned documents.
* @return information about the documents
@@ -303,8 +340,7 @@ MultiDocumentEntity> replaceDocuments(
* they do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @return information about the document
* @see API
* Documentation
@@ -317,8 +353,7 @@ MultiDocumentEntity> replaceDocuments(
* they do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @return information about the document
* @see API
@@ -332,8 +367,7 @@ MultiDocumentEntity> replaceDocuments(
* they do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @param returnType Type of the returned newDocument and/or oldDocument
* @return information about the document
@@ -349,7 +383,37 @@ DocumentUpdateEntity updateDocument(String key, Object value, DocumentUpd
* attributes from the patch documents will be added to the existing documents if they do not yet exist, and
* overwritten in the existing documents if they do exist there.
*
- * @param values A list of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
+ * @param values Raw data representing a collection of documents
+ * @return information about the documents
+ * @see
+ * API
+ * Documentation
+ */
+ MultiDocumentEntity> updateDocuments(RawData values);
+
+ /**
+ * Partially updates documents, the documents to update are specified by the _key attributes in the objects on
+ * values. Vales must contain a list of document updates with the attributes to patch (the patch documents). All
+ * attributes from the patch documents will be added to the existing documents if they do not yet exist, and
+ * overwritten in the existing documents if they do exist there.
+ *
+ * @param values Raw data representing a collection of documents
+ * @param options Additional options
+ * @return information about the documents
+ * @see
+ * API
+ * Documentation
+ */
+ MultiDocumentEntity> updateDocuments(
+ RawData values, DocumentUpdateOptions options);
+
+ /**
+ * Partially updates documents, the documents to update are specified by the _key attributes in the objects on
+ * values. Vales must contain a list of document updates with the attributes to patch (the patch documents). All
+ * attributes from the patch documents will be added to the existing documents if they do not yet exist, and
+ * overwritten in the existing documents if they do exist there.
+ *
+ * @param values A list of documents (POJO or {@link com.arangodb.util.RawData})
* @return information about the documents
* @see
* API
@@ -363,8 +427,7 @@ DocumentUpdateEntity updateDocument(String key, Object value, DocumentUpd
* attributes from the patch documents will be added to the existing documents if they do not yet exist, and
* overwritten in the existing documents if they do exist there.
*
- * @param values A list of documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param values A list of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @return information about the documents
* @see
@@ -380,8 +443,7 @@ MultiDocumentEntity> updateDocuments(
* attributes from the patch documents will be added to the existing documents if they do not yet exist, and
* overwritten in the existing documents if they do exist there.
*
- * @param values A list of documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param values A list of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @param returnType Type of the returned newDocument and/or oldDocument
* @return information about the documents
@@ -428,6 +490,30 @@ MultiDocumentEntity> updateDocuments(
*/
DocumentDeleteEntity deleteDocument(String key, DocumentDeleteOptions options, Class type);
+ /**
+ * Deletes multiple documents from the collection.
+ *
+ * @param values Raw data representing the keys of the documents or the documents themselves
+ * @return information about the documents
+ * @see API
+ * Documentation
+ */
+ MultiDocumentEntity> deleteDocuments(RawData values);
+
+ /**
+ * Deletes multiple documents from the collection.
+ *
+ * @param values Raw data representing the keys of the documents or the documents themselves
+ * @param options Additional options
+ * @return information about the documents
+ * @see API
+ * Documentation
+ */
+ MultiDocumentEntity> deleteDocuments(
+ RawData values, DocumentDeleteOptions options);
+
/**
* Deletes multiple documents from the collection.
*
diff --git a/src/main/java/com/arangodb/ArangoDatabase.java b/src/main/java/com/arangodb/ArangoDatabase.java
index af8b02808..16cd93cbf 100644
--- a/src/main/java/com/arangodb/ArangoDatabase.java
+++ b/src/main/java/com/arangodb/ArangoDatabase.java
@@ -245,8 +245,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
* @param query An AQL query string
* @param bindVars key/value pairs defining the variables to bind the query to
* @param options Additional options that will be passed to the query API, can be null
- * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see
* API
@@ -260,8 +259,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
*
* @param query An AQL query string
* @param options Additional options that will be passed to the query API, can be null
- * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see
* API
@@ -275,8 +273,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
*
* @param query An AQL query string
* @param bindVars key/value pairs defining the variables to bind the query to
- * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see
* API
@@ -289,8 +286,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
* result list.
*
* @param query An AQL query string
- * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see
* API
@@ -302,8 +298,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
* Return an cursor from the given cursor-ID if still existing
*
* @param cursorId The ID of the cursor
- * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see API
@@ -586,8 +580,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
* Reads a single document
*
* @param id The id of the document
- * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the document (POJO or {@link com.arangodb.util.RawData})
* @return the document identified by the id
* @see API
* Documentation
@@ -598,8 +591,7 @@ public interface ArangoDatabase extends ArangoSerdeAccessor {
* Reads a single document
*
* @param id The id of the document
- * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return the document identified by the id
* @see API
diff --git a/src/main/java/com/arangodb/ArangoEdgeCollection.java b/src/main/java/com/arangodb/ArangoEdgeCollection.java
index 333cdeb34..7558d9f65 100644
--- a/src/main/java/com/arangodb/ArangoEdgeCollection.java
+++ b/src/main/java/com/arangodb/ArangoEdgeCollection.java
@@ -49,8 +49,7 @@ public interface ArangoEdgeCollection extends ArangoSerdeAccessor {
/**
* Creates a new edge in the collection
*
- * @param value A representation of a single edge (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single edge (POJO or {@link com.arangodb.util.RawData})
* @return information about the edge
* @see API Documentation
*/
@@ -59,8 +58,7 @@ public interface ArangoEdgeCollection extends ArangoSerdeAccessor {
/**
* Creates a new edge in the collection
*
- * @param value A representation of a single edge (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single edge (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return information about the edge
* @see API Documentation
@@ -71,8 +69,7 @@ public interface ArangoEdgeCollection extends ArangoSerdeAccessor {
* Fetches an existing edge
*
* @param key The key of the edge
- * @param type The type of the edge-document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the edge-document (POJO or {@link com.arangodb.util.RawData})
* @return the edge identified by the key
* @see API Documentation
*/
@@ -82,8 +79,7 @@ public interface ArangoEdgeCollection extends ArangoSerdeAccessor {
* Fetches an existing edge
*
* @param key The key of the edge
- * @param type The type of the edge-document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the edge-document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return the edge identified by the key
* @see API Documentation
@@ -95,8 +91,7 @@ public interface ArangoEdgeCollection extends ArangoSerdeAccessor {
* violated
*
* @param key The key of the edge
- * @param value A representation of a single edge (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single edge (POJO or {@link com.arangodb.util.RawData})
* @return information about the edge
* @see API Documentation
*/
@@ -107,8 +102,7 @@ public interface ArangoEdgeCollection extends ArangoSerdeAccessor {
* violated
*
* @param key The key of the edge
- * @param value A representation of a single edge (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single edge (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return information about the edge
* @see API Documentation
@@ -121,8 +115,7 @@ public interface ArangoEdgeCollection extends ArangoSerdeAccessor {
* do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the edge
- * @param value A representation of a single edge (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single edge (POJO or {@link com.arangodb.util.RawData})
* @return information about the edge
* @see API Documentation
*/
@@ -134,8 +127,7 @@ public interface ArangoEdgeCollection extends ArangoSerdeAccessor {
* do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the edge
- * @param value A representation of a single edge (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single edge (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return information about the edge
* @see API Documentation
diff --git a/src/main/java/com/arangodb/ArangoVertexCollection.java b/src/main/java/com/arangodb/ArangoVertexCollection.java
index 7a3954195..03d755327 100644
--- a/src/main/java/com/arangodb/ArangoVertexCollection.java
+++ b/src/main/java/com/arangodb/ArangoVertexCollection.java
@@ -58,8 +58,7 @@ public interface ArangoVertexCollection extends ArangoSerdeAccessor {
/**
* Creates a new vertex in the collection
*
- * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single vertex (POJO or {@link com.arangodb.util.RawData})
* @return information about the vertex
* @see
* API Documentation
@@ -69,8 +68,7 @@ public interface ArangoVertexCollection extends ArangoSerdeAccessor {
/**
* Creates a new vertex in the collection
*
- * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single vertex (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return information about the vertex
* @see
@@ -82,8 +80,7 @@ public interface ArangoVertexCollection extends ArangoSerdeAccessor {
* Retrieves the vertex document with the given {@code key} from the collection.
*
* @param key The key of the vertex
- * @param type The type of the vertex-document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the vertex-document (POJO or {@link com.arangodb.util.RawData})
* @return the vertex identified by the key
* @see API Documentation
*/
@@ -93,8 +90,7 @@ public interface ArangoVertexCollection extends ArangoSerdeAccessor {
* Retrieves the vertex document with the given {@code key} from the collection.
*
* @param key The key of the vertex
- * @param type The type of the vertex-document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the vertex-document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return the vertex identified by the key
* @see API Documentation
@@ -106,8 +102,7 @@ public interface ArangoVertexCollection extends ArangoSerdeAccessor {
* violated
*
* @param key The key of the vertex
- * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single vertex (POJO or {@link com.arangodb.util.RawData})
* @return information about the vertex
* @see API
* Documentation
@@ -119,8 +114,7 @@ public interface ArangoVertexCollection extends ArangoSerdeAccessor {
* violated
*
* @param key The key of the vertex
- * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single vertex (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return information about the vertex
* @see API
@@ -134,8 +128,7 @@ public interface ArangoVertexCollection extends ArangoSerdeAccessor {
* do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the vertex
- * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single vertex (POJO or {@link com.arangodb.util.RawData})
* @return information about the vertex
* @see
* API Documentation
@@ -148,8 +141,7 @@ public interface ArangoVertexCollection extends ArangoSerdeAccessor {
* do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the vertex
- * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single vertex (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return information about the vertex
* @see
diff --git a/src/main/java/com/arangodb/async/ArangoCollectionAsync.java b/src/main/java/com/arangodb/async/ArangoCollectionAsync.java
index d155ba0ed..b2d21d01b 100644
--- a/src/main/java/com/arangodb/async/ArangoCollectionAsync.java
+++ b/src/main/java/com/arangodb/async/ArangoCollectionAsync.java
@@ -23,6 +23,7 @@
import com.arangodb.ArangoSerdeAccessor;
import com.arangodb.entity.*;
import com.arangodb.model.*;
+import com.arangodb.util.RawData;
import java.util.Collection;
import java.util.concurrent.CompletableFuture;
@@ -54,8 +55,7 @@ public interface ArangoCollectionAsync extends ArangoSerdeAccessor {
* Creates a new document from the given document, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @return information about the document
* @see API
* Documentation
@@ -66,8 +66,7 @@ public interface ArangoCollectionAsync extends ArangoSerdeAccessor {
* Creates a new document from the given document, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @return information about the document
* @see API
@@ -79,8 +78,7 @@ public interface ArangoCollectionAsync extends ArangoSerdeAccessor {
* Creates a new document from the given document, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @param type Deserialization target type for the returned documents.
* @return information about the document
@@ -94,7 +92,32 @@ CompletableFuture> insertDocument(final T value, fin
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
+ * @param values Raw data representing a collection of documents
+ * @return information about the documents
+ * @see API
+ * Documentation
+ */
+ CompletableFuture>> insertDocuments(final RawData values);
+
+ /**
+ * Creates new documents from the given documents, unless there is already a document with the _key given. If no
+ * _key is given, a new unique _key is generated automatically.
+ *
+ * @param values Raw data representing a collection of documents
+ * @param options Additional options
+ * @return information about the documents
+ * @see API
+ * Documentation
+ */
+ CompletableFuture>> insertDocuments(
+ final RawData values,
+ final DocumentCreateOptions options);
+
+ /**
+ * Creates new documents from the given documents, unless there is already a document with the _key given. If no
+ * _key is given, a new unique _key is generated automatically.
+ *
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @return information about the documents
* @see API
* Documentation
@@ -105,8 +128,7 @@ CompletableFuture> insertDocument(final T value, fin
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @return information about the documents
* @see API
@@ -120,8 +142,7 @@ CompletableFuture>> insertDocume
* Creates new documents from the given documents, unless there is already a document with the _key given. If no
* _key is given, a new unique _key is generated automatically.
*
- * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @param type Deserialization target type for the returned documents.
* @return information about the documents
@@ -136,7 +157,7 @@ CompletableFuture>> insertDocume
/**
* Imports documents
*
- * @param values a list of Objects that will be stored as documents
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @return information about the import
*/
CompletableFuture importDocuments(final Collection> values);
@@ -144,7 +165,7 @@ CompletableFuture>> insertDocume
/**
* Imports documents
*
- * @param values a list of Objects that will be stored as documents
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return information about the import
*/
@@ -155,26 +176,25 @@ CompletableFuture importDocuments(
/**
* Imports documents
*
- * @param values JSON-encoded array of objects that will be stored as documents
+ * @param values Raw data representing a collection of documents
* @return information about the import
*/
- CompletableFuture importDocuments(final String values);
+ CompletableFuture importDocuments(final RawData values);
/**
* Imports documents
*
- * @param values JSON-encoded array of objects that will be stored as documents
+ * @param values Raw data representing a collection of documents
* @param options Additional options, can be null
* @return information about the import
*/
- CompletableFuture importDocuments(final String values, final DocumentImportOptions options);
+ CompletableFuture importDocuments(final RawData values, final DocumentImportOptions options);
/**
* Reads a single document
*
* @param key The key of the document
- * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the document (POJO or {@link com.arangodb.util.RawData})
* @return the document identified by the key
* @see API
* Documentation
@@ -185,8 +205,7 @@ CompletableFuture importDocuments(
* Reads a single document
*
* @param key The key of the document
- * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return the document identified by the key
* @see API
@@ -198,8 +217,7 @@ CompletableFuture importDocuments(
* Reads multiple documents
*
* @param keys The keys of the documents
- * @param type The type of the documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the documents (POJO or {@link com.arangodb.util.RawData})
* @return the documents and possible errors
*/
CompletableFuture> getDocuments(final Collection keys, final Class type);
@@ -208,8 +226,7 @@ CompletableFuture importDocuments(
* Reads multiple documents
*
* @param keys The keys of the documents
- * @param type The type of the documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return the documents and possible errors
*/
@@ -223,8 +240,7 @@ CompletableFuture> getDocuments(
* violated
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @return information about the document
* @see
* API
@@ -237,8 +253,7 @@ CompletableFuture> getDocuments(
* violated
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @return information about the document
* @see
@@ -255,8 +270,7 @@ CompletableFuture> replaceDocument(
* violated
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @param type Deserialization target type for the returned documents.
* @return information about the document
@@ -274,7 +288,34 @@ CompletableFuture> replaceDocument(
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
* specified by the _key attributes in the documents in values.
*
- * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
+ * @param values Raw data representing a collection of documents
+ * @return information about the documents
+ * @see
+ * API
+ * Documentation
+ */
+ CompletableFuture>> replaceDocuments(final RawData values);
+
+ /**
+ * Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
+ * specified by the _key attributes in the documents in values.
+ *
+ * @param values Raw data representing a collection of documents
+ * @param options Additional options
+ * @return information about the documents
+ * @see
+ * API
+ * Documentation
+ */
+ CompletableFuture>> replaceDocuments(
+ final RawData values,
+ final DocumentReplaceOptions options);
+
+ /**
+ * Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
+ * specified by the _key attributes in the documents in values.
+ *
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @return information about the documents
* @see
* API
@@ -286,8 +327,7 @@ CompletableFuture> replaceDocument(
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
* specified by the _key attributes in the documents in values.
*
- * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @return information about the documents
* @see
@@ -302,8 +342,7 @@ CompletableFuture>> replaceDocum
* Replaces multiple documents in the specified collection with the ones in the values, the replaced documents are
* specified by the _key attributes in the documents in values.
*
- * @param values A List of documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param values A List of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @param type Deserialization target type for the returned documents.
* @return information about the documents
@@ -322,8 +361,7 @@ CompletableFuture>> replaceDocum
* they do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @return information about the document
* @see API
* Documentation
@@ -336,8 +374,7 @@ CompletableFuture>> replaceDocum
* they do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @return information about the document
* @see API
@@ -354,8 +391,7 @@ CompletableFuture> updateDocument(
* they do not yet exist, and overwritten in the existing document if they do exist there.
*
* @param key The key of the document
- * @param value A representation of a single document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @param returnType Type of the returned newDocument and/or oldDocument
* @return information about the document
@@ -374,7 +410,38 @@ CompletableFuture> updateDocument(
* attributes from the patch documents will be added to the existing documents if they do not yet exist, and
* overwritten in the existing documents if they do exist there.
*
- * @param values A list of documents (POJO, {@link com.arangodb.util.RawJson} or {@link com.arangodb.util.RawBytes})
+ * @param values Raw data representing a collection of documents
+ * @return information about the documents
+ * @see
+ * API
+ * Documentation
+ */
+ CompletableFuture>> updateDocuments(final RawData values);
+
+ /**
+ * Partially updates documents, the documents to update are specified by the _key attributes in the objects on
+ * values. Vales must contain a list of document updates with the attributes to patch (the patch documents). All
+ * attributes from the patch documents will be added to the existing documents if they do not yet exist, and
+ * overwritten in the existing documents if they do exist there.
+ *
+ * @param values Raw data representing a collection of documents
+ * @param options Additional options
+ * @return information about the documents
+ * @see
+ * API
+ * Documentation
+ */
+ CompletableFuture>> updateDocuments(
+ final RawData values,
+ final DocumentUpdateOptions options);
+
+ /**
+ * Partially updates documents, the documents to update are specified by the _key attributes in the objects on
+ * values. Vales must contain a list of document updates with the attributes to patch (the patch documents). All
+ * attributes from the patch documents will be added to the existing documents if they do not yet exist, and
+ * overwritten in the existing documents if they do exist there.
+ *
+ * @param values A list of documents (POJO or {@link com.arangodb.util.RawData})
* @return information about the documents
* @see
* API
@@ -388,8 +455,7 @@ CompletableFuture> updateDocument(
* attributes from the patch documents will be added to the existing documents if they do not yet exist, and
* overwritten in the existing documents if they do exist there.
*
- * @param values A list of documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param values A list of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @return information about the documents
* @see
@@ -406,8 +472,7 @@ CompletableFuture>> updateDocume
* attributes from the patch documents will be added to the existing documents if they do not yet exist, and
* overwritten in the existing documents if they do exist there.
*
- * @param values A list of documents (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param values A list of documents (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options
* @param returnType Type of the returned newDocument and/or oldDocument
* @return information about the documents
@@ -461,6 +526,31 @@ CompletableFuture> deleteDocument(
final DocumentDeleteOptions options,
final Class type);
+ /**
+ * Removes multiple document
+ *
+ * @param values Raw data representing the keys of the documents or the documents themselves
+ * @return information about the documents
+ * @see API
+ * Documentation
+ */
+ CompletableFuture>> deleteDocuments(final RawData values);
+
+ /**
+ * Removes multiple document
+ *
+ * @param values Raw data representing the keys of the documents or the documents themselves
+ * @param options Additional options
+ * @return information about the documents
+ * @see API
+ * Documentation
+ */
+ CompletableFuture>> deleteDocuments(
+ final RawData values,
+ final DocumentDeleteOptions options);
+
/**
* Removes multiple document
*
diff --git a/src/main/java/com/arangodb/async/ArangoDatabaseAsync.java b/src/main/java/com/arangodb/async/ArangoDatabaseAsync.java
index 6dc963151..73db9152e 100644
--- a/src/main/java/com/arangodb/async/ArangoDatabaseAsync.java
+++ b/src/main/java/com/arangodb/async/ArangoDatabaseAsync.java
@@ -250,8 +250,7 @@ public interface ArangoDatabaseAsync extends ArangoSerdeAccessor {
* @param query contains the query string to be executed
* @param bindVars key/value pairs representing the bind parameters
* @param options Additional options, can be null
- * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see
* API
@@ -269,8 +268,7 @@ CompletableFuture> query(
*
* @param query contains the query string to be executed
* @param options Additional options, can be null
- * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see
* API
@@ -287,8 +285,7 @@ CompletableFuture> query(
*
* @param query contains the query string to be executed
* @param bindVars key/value pairs representing the bind parameters
- * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see
* API
@@ -304,8 +301,7 @@ CompletableFuture> query(
* result list.
*
* @param query contains the query string to be executed
- * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see
* API
@@ -317,8 +313,7 @@ CompletableFuture> query(
* Return an cursor from the given cursor-ID if still existing
*
* @param cursorId The ID of the cursor
- * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @return cursor of the results
* @see createGraph(
* Execute a server-side transaction
*
* @param action the actual transaction operations to be executed, in the form of stringified JavaScript code
- * @param type The type of the result (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the result (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return the result of the transaction if it succeeded
* @see API
@@ -615,8 +609,7 @@ CompletableFuture createGraph(
* Reads a single document
*
* @param id The id of the document
- * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the document (POJO or {@link com.arangodb.util.RawData})
* @return the document identified by the id
* @see API
* Documentation
@@ -627,8 +620,7 @@ CompletableFuture createGraph(
* Reads a single document
*
* @param id The id of the document
- * @param type The type of the document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return the document identified by the id
* @see API
diff --git a/src/main/java/com/arangodb/async/ArangoEdgeCollectionAsync.java b/src/main/java/com/arangodb/async/ArangoEdgeCollectionAsync.java
index d2465cd8f..eab16f39c 100644
--- a/src/main/java/com/arangodb/async/ArangoEdgeCollectionAsync.java
+++ b/src/main/java/com/arangodb/async/ArangoEdgeCollectionAsync.java
@@ -52,8 +52,7 @@ public interface ArangoEdgeCollectionAsync extends ArangoSerdeAccessor {
/**
* Creates a new edge in the collection
*
- * @param value A representation of a single edge (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single edge (POJO or {@link com.arangodb.util.RawData}
* @return information about the edge
* @see API Documentation
*/
@@ -62,8 +61,7 @@ public interface ArangoEdgeCollectionAsync extends ArangoSerdeAccessor {
/**
* Creates a new edge in the collection
*
- * @param value A representation of a single edge (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single edge (POJO or {@link com.arangodb.util.RawData}
* @param options Additional options, can be null
* @return information about the edge
* @see API Documentation
@@ -74,8 +72,7 @@ public interface ArangoEdgeCollectionAsync extends ArangoSerdeAccessor {
* Fetches an existing edge
*
* @param key The key of the edge
- * @param type The type of the edge-document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the edge-document (POJO or {@link com.arangodb.util.RawData}
* @return the edge identified by the key
* @see API Documentation
*/
@@ -85,8 +82,7 @@ public interface ArangoEdgeCollectionAsync extends ArangoSerdeAccessor {
* Fetches an existing edge
*
* @param key The key of the edge
- * @param type The type of the edge-document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the edge-document (POJO or {@link com.arangodb.util.RawData}
* @param options Additional options, can be null
* @return the edge identified by the key
* @see API Documentation
diff --git a/src/main/java/com/arangodb/async/ArangoVertexCollectionAsync.java b/src/main/java/com/arangodb/async/ArangoVertexCollectionAsync.java
index 38e22d660..c26be8f55 100644
--- a/src/main/java/com/arangodb/async/ArangoVertexCollectionAsync.java
+++ b/src/main/java/com/arangodb/async/ArangoVertexCollectionAsync.java
@@ -62,8 +62,7 @@ public interface ArangoVertexCollectionAsync extends ArangoSerdeAccessor {
/**
* Creates a new vertex in the collection
*
- * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single vertex (POJO or {@link com.arangodb.util.RawData})
* @return information about the vertex
* @see
* API Documentation
@@ -73,8 +72,7 @@ public interface ArangoVertexCollectionAsync extends ArangoSerdeAccessor {
/**
* Creates a new vertex in the collection
*
- * @param value A representation of a single vertex (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param value A representation of a single vertex (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return information about the vertex
* @see
@@ -86,8 +84,7 @@ public interface ArangoVertexCollectionAsync extends ArangoSerdeAccessor {
* Fetches an existing vertex
*
* @param key The key of the vertex
- * @param type The type of the vertex-document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the vertex-document (POJO or {@link com.arangodb.util.RawData})
* @return the vertex identified by the key
* @see API Documentation
*/
@@ -97,8 +94,7 @@ public interface ArangoVertexCollectionAsync extends ArangoSerdeAccessor {
* Fetches an existing vertex
*
* @param key The key of the vertex
- * @param type The type of the vertex-document (POJO, {@link com.arangodb.util.RawJson} or
- * {@link com.arangodb.util.RawBytes})
+ * @param type The type of the vertex-document (POJO or {@link com.arangodb.util.RawData})
* @param options Additional options, can be null
* @return the vertex identified by the key
* @see API Documentation
diff --git a/src/main/java/com/arangodb/async/internal/ArangoCollectionAsyncImpl.java b/src/main/java/com/arangodb/async/internal/ArangoCollectionAsyncImpl.java
index ba93556ba..b06bc0ebf 100644
--- a/src/main/java/com/arangodb/async/internal/ArangoCollectionAsyncImpl.java
+++ b/src/main/java/com/arangodb/async/internal/ArangoCollectionAsyncImpl.java
@@ -25,6 +25,7 @@
import com.arangodb.internal.InternalArangoCollection;
import com.arangodb.internal.util.DocumentUtil;
import com.arangodb.model.*;
+import com.arangodb.util.RawData;
import java.util.Collection;
import java.util.Objects;
@@ -65,6 +66,22 @@ public CompletableFuture> insertDocument(T value, Do
constructParametricType(DocumentCreateEntity.class, type));
}
+ @Override
+ public CompletableFuture>> insertDocuments(RawData values) {
+ return executor
+ .execute(insertDocumentsRequest(values, new DocumentCreateOptions()),
+ insertDocumentsResponseDeserializer(Void.class));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public CompletableFuture>> insertDocuments(RawData values,
+ DocumentCreateOptions options) {
+ return executor
+ .execute(insertDocumentsRequest(values, options),
+ insertDocumentsResponseDeserializer((Class) values.getClass()));
+ }
+
@Override
public CompletableFuture>> insertDocuments(
final Collection> values) {
@@ -101,15 +118,13 @@ public CompletableFuture importDocuments(
}
@Override
- public CompletableFuture importDocuments(final String values) {
+ public CompletableFuture importDocuments(RawData values) {
return executor.execute(importDocumentsRequest(values, new DocumentImportOptions()),
DocumentImportEntity.class);
}
@Override
- public CompletableFuture importDocuments(
- final String values,
- final DocumentImportOptions options) {
+ public CompletableFuture importDocuments(RawData values, DocumentImportOptions options) {
return executor.execute(importDocumentsRequest(values, options), DocumentImportEntity.class);
}
@@ -167,6 +182,20 @@ public CompletableFuture> replaceDocument(String key
constructParametricType(DocumentUpdateEntity.class, type));
}
+ @Override
+ public CompletableFuture>> replaceDocuments(RawData values) {
+ return executor.execute(replaceDocumentsRequest(values, new DocumentReplaceOptions()),
+ replaceDocumentsResponseDeserializer(Void.class));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public CompletableFuture>> replaceDocuments(RawData values,
+ DocumentReplaceOptions options) {
+ return executor.execute(replaceDocumentsRequest(values, options),
+ replaceDocumentsResponseDeserializer((Class) values.getClass()));
+ }
+
@Override
public CompletableFuture>> replaceDocuments(
final Collection> values) {
@@ -212,6 +241,22 @@ public CompletableFuture> updateDocument(
constructParametricType(DocumentUpdateEntity.class, returnType));
}
+ @Override
+ public CompletableFuture>> updateDocuments(RawData values) {
+ return executor
+ .execute(updateDocumentsRequest(values, new DocumentUpdateOptions()),
+ updateDocumentsResponseDeserializer(Void.class));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public CompletableFuture>> updateDocuments(RawData values,
+ DocumentUpdateOptions options) {
+ return executor
+ .execute(updateDocumentsRequest(values, options),
+ updateDocumentsResponseDeserializer((Class) values.getClass()));
+ }
+
@Override
public CompletableFuture>> updateDocuments(
final Collection> values) {
@@ -254,6 +299,20 @@ public CompletableFuture> deleteDocument(
constructParametricType(DocumentDeleteEntity.class, type));
}
+ @Override
+ public CompletableFuture>> deleteDocuments(RawData values) {
+ return executor.execute(deleteDocumentsRequest(values, new DocumentDeleteOptions()),
+ deleteDocumentsResponseDeserializer(Void.class));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public CompletableFuture>> deleteDocuments(RawData values,
+ DocumentDeleteOptions options) {
+ return executor.execute(deleteDocumentsRequest(values, options),
+ deleteDocumentsResponseDeserializer((Class) values.getClass()));
+ }
+
@Override
public CompletableFuture>> deleteDocuments(
final Collection> values) {
diff --git a/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java b/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java
index 9c211d35d..8fd3102e7 100644
--- a/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java
+++ b/src/main/java/com/arangodb/internal/ArangoCollectionImpl.java
@@ -25,6 +25,7 @@
import com.arangodb.entity.*;
import com.arangodb.internal.util.DocumentUtil;
import com.arangodb.model.*;
+import com.arangodb.util.RawData;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -64,6 +65,22 @@ public DocumentCreateEntity insertDocument(final T value, final DocumentC
constructParametricType(DocumentCreateEntity.class, type));
}
+ @Override
+ public MultiDocumentEntity> insertDocuments(RawData values) {
+ return executor
+ .execute(insertDocumentsRequest(values, new DocumentCreateOptions()),
+ insertDocumentsResponseDeserializer(Void.class));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public MultiDocumentEntity> insertDocuments(RawData values,
+ DocumentCreateOptions options) {
+ return executor
+ .execute(insertDocumentsRequest(values, options),
+ insertDocumentsResponseDeserializer((Class) values.getClass()));
+ }
+
@Override
public MultiDocumentEntity> insertDocuments(final Collection> values) {
return executor
@@ -97,12 +114,12 @@ public DocumentImportEntity importDocuments(final Collection> values, final Do
}
@Override
- public DocumentImportEntity importDocuments(final String values) {
+ public DocumentImportEntity importDocuments(RawData values) {
return importDocuments(values, new DocumentImportOptions());
}
@Override
- public DocumentImportEntity importDocuments(final String values, final DocumentImportOptions options) {
+ public DocumentImportEntity importDocuments(RawData values, DocumentImportOptions options) {
return executor.execute(importDocumentsRequest(values, options), DocumentImportEntity.class);
}
@@ -165,6 +182,20 @@ public DocumentUpdateEntity replaceDocument(String key, T value, Document
constructParametricType(DocumentUpdateEntity.class, type));
}
+ @Override
+ public MultiDocumentEntity> replaceDocuments(RawData values) {
+ return executor.execute(replaceDocumentsRequest(values, new DocumentReplaceOptions()),
+ replaceDocumentsResponseDeserializer(Void.class));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public MultiDocumentEntity> replaceDocuments(RawData values,
+ DocumentReplaceOptions options) {
+ return executor.execute(replaceDocumentsRequest(values, options),
+ replaceDocumentsResponseDeserializer((Class) values.getClass()));
+ }
+
@Override
public MultiDocumentEntity> replaceDocuments(final Collection> values) {
return executor.execute(replaceDocumentsRequest(values, new DocumentReplaceOptions()),
@@ -204,6 +235,22 @@ public DocumentUpdateEntity updateDocument(
constructParametricType(DocumentUpdateEntity.class, returnType));
}
+ @Override
+ public MultiDocumentEntity> updateDocuments(RawData values) {
+ return executor
+ .execute(updateDocumentsRequest(values, new DocumentUpdateOptions()),
+ updateDocumentsResponseDeserializer(Void.class));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public MultiDocumentEntity> updateDocuments(RawData values,
+ DocumentUpdateOptions options) {
+ return executor
+ .execute(updateDocumentsRequest(values, options),
+ updateDocumentsResponseDeserializer((Class) values.getClass()));
+ }
+
@Override
public MultiDocumentEntity> updateDocuments(final Collection> values) {
return updateDocuments(values, new DocumentUpdateOptions(), Void.class);
@@ -240,6 +287,20 @@ public DocumentDeleteEntity deleteDocument(
constructParametricType(DocumentDeleteEntity.class, type));
}
+ @Override
+ public MultiDocumentEntity> deleteDocuments(RawData values) {
+ return executor.execute(deleteDocumentsRequest(values, new DocumentDeleteOptions()),
+ deleteDocumentsResponseDeserializer(Void.class));
+ }
+
+ @Override
+ @SuppressWarnings("unchecked")
+ public MultiDocumentEntity> deleteDocuments(RawData values,
+ DocumentDeleteOptions options) {
+ return executor.execute(deleteDocumentsRequest(values, options),
+ deleteDocumentsResponseDeserializer((Class) values.getClass()));
+ }
+
@Override
public MultiDocumentEntity> deleteDocuments(final Collection> values) {
return deleteDocuments(values, new DocumentDeleteOptions(), Void.class);
diff --git a/src/main/java/com/arangodb/internal/InternalArangoCollection.java b/src/main/java/com/arangodb/internal/InternalArangoCollection.java
index 58061cc0e..4d6831533 100644
--- a/src/main/java/com/arangodb/internal/InternalArangoCollection.java
+++ b/src/main/java/com/arangodb/internal/InternalArangoCollection.java
@@ -24,10 +24,10 @@
import com.arangodb.DbName;
import com.arangodb.entity.*;
import com.arangodb.internal.ArangoExecutor.ResponseDeserializer;
-import com.arangodb.internal.serde.SerdeUtils;
import com.arangodb.internal.util.DocumentUtil;
import com.arangodb.internal.util.RequestUtils;
import com.arangodb.model.*;
+import com.arangodb.util.RawData;
import com.arangodb.velocystream.Request;
import com.arangodb.velocystream.RequestType;
import com.fasterxml.jackson.databind.JsonNode;
@@ -84,22 +84,25 @@ public String name() {
}
protected Request insertDocumentRequest(final T value, final DocumentCreateOptions options) {
- final Request request = request(db.dbName(), RequestType.POST, PATH_API_DOCUMENT, name);
- final DocumentCreateOptions params = (options != null ? options : new DocumentCreateOptions());
- request.putQueryParam(ArangoRequestParam.WAIT_FOR_SYNC, params.getWaitForSync());
- request.putQueryParam(RETURN_NEW, params.getReturnNew());
- request.putQueryParam(RETURN_OLD, params.getReturnOld());
- request.putQueryParam(SILENT, params.getSilent());
- request.putQueryParam(OVERWRITE_MODE, params.getOverwriteMode() != null ?
- params.getOverwriteMode().getValue() : null);
- request.putQueryParam(MERGE_OBJECTS, params.getMergeObjects());
- request.putQueryParam(KEEP_NULL, params.getKeepNull());
- request.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
+ final Request request = createInsertDocumentRequest(options);
request.setBody(getSerde().serializeUserData(value));
return request;
}
- protected Request insertDocumentsRequest(final Collection values, final DocumentCreateOptions params) {
+ protected Request insertDocumentsRequest(final RawData values, final DocumentCreateOptions options) {
+ Request request = createInsertDocumentRequest(options);
+ request.setBody(getSerde().serialize(values));
+ return request;
+ }
+
+ protected Request insertDocumentsRequest(final Collection values, final DocumentCreateOptions options) {
+ Request request = createInsertDocumentRequest(options);
+ request.setBody(getSerde().serializeCollectionUserData(values));
+ return request;
+ }
+
+ private Request createInsertDocumentRequest(final DocumentCreateOptions options) {
+ final DocumentCreateOptions params = (options != null ? options : new DocumentCreateOptions());
final Request request = request(db.dbName(), RequestType.POST, PATH_API_DOCUMENT, name);
request.putQueryParam(ArangoRequestParam.WAIT_FOR_SYNC, params.getWaitForSync());
request.putQueryParam(RETURN_NEW, params.getReturnNew());
@@ -110,7 +113,6 @@ protected Request insertDocumentsRequest(final Collection values, final D
request.putQueryParam(MERGE_OBJECTS, params.getMergeObjects());
request.putQueryParam(KEEP_NULL, params.getKeepNull());
request.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
- request.setBody(getSerde().serializeCollectionUserData(values));
return request;
}
@@ -141,8 +143,8 @@ protected ResponseDeserializer>>
};
}
- protected Request importDocumentsRequest(final String values, final DocumentImportOptions options) {
- return importDocumentsRequest(options).putQueryParam("type", ImportType.auto).setBody(getSerde().serialize(SerdeUtils.INSTANCE.parseJson(values)));
+ protected Request importDocumentsRequest(final RawData values, final DocumentImportOptions options) {
+ return importDocumentsRequest(options).putQueryParam("type", ImportType.auto).setBody(getSerde().serialize(values));
}
protected Request importDocumentsRequest(final Collection> values, final DocumentImportOptions options) {
@@ -218,22 +220,26 @@ protected ResponseDeserializer> getDocumentsResponseD
protected Request replaceDocumentRequest(
final String key, final T value, final DocumentReplaceOptions options) {
- final Request request = request(db.dbName(), RequestType.PUT, PATH_API_DOCUMENT,
- DocumentUtil.createDocumentHandle(name, key));
- final DocumentReplaceOptions params = (options != null ? options : new DocumentReplaceOptions());
- request.putHeaderParam(ArangoRequestParam.IF_MATCH, params.getIfMatch());
- request.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
- request.putQueryParam(ArangoRequestParam.WAIT_FOR_SYNC, params.getWaitForSync());
- request.putQueryParam(IGNORE_REVS, params.getIgnoreRevs());
- request.putQueryParam(RETURN_NEW, params.getReturnNew());
- request.putQueryParam(RETURN_OLD, params.getReturnOld());
- request.putQueryParam(SILENT, params.getSilent());
+ final Request request = createReplaceDocumentRequest(options, DocumentUtil.createDocumentHandle(name, key));
request.setBody(getSerde().serializeUserData(value));
return request;
}
- protected Request replaceDocumentsRequest(final Collection values, final DocumentReplaceOptions params) {
- final Request request = request(db.dbName(), RequestType.PUT, PATH_API_DOCUMENT, name);
+ protected Request replaceDocumentsRequest(final Collection values, final DocumentReplaceOptions options) {
+ final Request request = createReplaceDocumentRequest(options, name);
+ request.setBody(getSerde().serializeCollectionUserData(values));
+ return request;
+ }
+
+ protected Request replaceDocumentsRequest(final RawData values, final DocumentReplaceOptions options) {
+ final Request request = createReplaceDocumentRequest(options, name);
+ request.setBody(getSerde().serialize(values));
+ return request;
+ }
+
+ private Request createReplaceDocumentRequest(final DocumentReplaceOptions options, String path) {
+ final DocumentReplaceOptions params = (options != null ? options : new DocumentReplaceOptions());
+ final Request request = request(db.dbName(), RequestType.PUT, PATH_API_DOCUMENT, path);
request.putHeaderParam(ArangoRequestParam.IF_MATCH, params.getIfMatch());
request.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
request.putQueryParam(ArangoRequestParam.WAIT_FOR_SYNC, params.getWaitForSync());
@@ -241,7 +247,6 @@ protected Request replaceDocumentsRequest(final Collection values, final
request.putQueryParam(RETURN_NEW, params.getReturnNew());
request.putQueryParam(RETURN_OLD, params.getReturnOld());
request.putQueryParam(SILENT, params.getSilent());
- request.setBody(getSerde().serializeCollectionUserData(values));
return request;
}
@@ -274,35 +279,35 @@ protected ResponseDeserializer>>
}
protected Request updateDocumentRequest(final String key, final T value, final DocumentUpdateOptions options) {
- final Request request = request(db.dbName(), RequestType.PATCH, PATH_API_DOCUMENT,
- DocumentUtil.createDocumentHandle(name, key));
- final DocumentUpdateOptions params = (options != null ? options : new DocumentUpdateOptions());
- request.putHeaderParam(ArangoRequestParam.IF_MATCH, params.getIfMatch());
- request.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
- request.putQueryParam(ArangoRequestParam.KEEP_NULL, params.getKeepNull());
- request.putQueryParam(ArangoRequestParam.WAIT_FOR_SYNC, params.getWaitForSync());
- request.putQueryParam(MERGE_OBJECTS, params.getMergeObjects());
- request.putQueryParam(IGNORE_REVS, params.getIgnoreRevs());
- request.putQueryParam(RETURN_NEW, params.getReturnNew());
- request.putQueryParam(RETURN_OLD, params.getReturnOld());
- request.putQueryParam(SILENT, params.getSilent());
+ final Request request = createUpdateDocumentRequest(options, DocumentUtil.createDocumentHandle(name, key));
request.setBody(getSerde().serializeUserData(value));
return request;
}
- protected Request updateDocumentsRequest(final Collection values, final DocumentUpdateOptions params) {
- final Request request = request(db.dbName(), RequestType.PATCH, PATH_API_DOCUMENT, name);
- final Boolean keepNull = params.getKeepNull();
+ protected Request updateDocumentsRequest(final Collection values, final DocumentUpdateOptions options) {
+ final Request request = createUpdateDocumentRequest(options, name);
+ request.setBody(getSerde().serializeCollectionUserData(values));
+ return request;
+ }
+
+ protected Request updateDocumentsRequest(final RawData values, final DocumentUpdateOptions options) {
+ final Request request = createUpdateDocumentRequest(options, name);
+ request.setBody(getSerde().serialize(values));
+ return request;
+ }
+
+ private Request createUpdateDocumentRequest(final DocumentUpdateOptions options, String path) {
+ final DocumentUpdateOptions params = (options != null ? options : new DocumentUpdateOptions());
+ final Request request = request(db.dbName(), RequestType.PATCH, PATH_API_DOCUMENT, path);
request.putHeaderParam(ArangoRequestParam.IF_MATCH, params.getIfMatch());
request.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
- request.putQueryParam(ArangoRequestParam.KEEP_NULL, keepNull);
+ request.putQueryParam(ArangoRequestParam.KEEP_NULL, params.getKeepNull());
request.putQueryParam(ArangoRequestParam.WAIT_FOR_SYNC, params.getWaitForSync());
request.putQueryParam(MERGE_OBJECTS, params.getMergeObjects());
request.putQueryParam(IGNORE_REVS, params.getIgnoreRevs());
request.putQueryParam(RETURN_NEW, params.getReturnNew());
request.putQueryParam(RETURN_OLD, params.getReturnOld());
request.putQueryParam(SILENT, params.getSilent());
- request.setBody(getSerde().serializeCollectionUserData(values));
return request;
}
@@ -335,25 +340,29 @@ protected ResponseDeserializer>>
}
protected Request deleteDocumentRequest(final String key, final DocumentDeleteOptions options) {
- final Request request = request(db.dbName(), RequestType.DELETE, PATH_API_DOCUMENT,
- DocumentUtil.createDocumentHandle(name, key));
- final DocumentDeleteOptions params = (options != null ? options : new DocumentDeleteOptions());
- request.putHeaderParam(ArangoRequestParam.IF_MATCH, params.getIfMatch());
- request.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
- request.putQueryParam(ArangoRequestParam.WAIT_FOR_SYNC, params.getWaitForSync());
- request.putQueryParam(RETURN_OLD, params.getReturnOld());
- request.putQueryParam(SILENT, params.getSilent());
+ return createDeleteDocumentRequest(options, DocumentUtil.createDocumentHandle(name, key));
+ }
+
+ protected Request deleteDocumentsRequest(final Collection docs, final DocumentDeleteOptions options) {
+ final Request request = createDeleteDocumentRequest(options, name);
+ request.setBody(getSerde().serializeCollectionUserData(docs));
return request;
}
- protected Request deleteDocumentsRequest(final Collection keys, final DocumentDeleteOptions options) {
- final Request request = request(db.dbName(), RequestType.DELETE, PATH_API_DOCUMENT, name);
+ protected Request deleteDocumentsRequest(final RawData docs, final DocumentDeleteOptions options) {
+ final Request request = createDeleteDocumentRequest(options, name);
+ request.setBody(getSerde().serialize(docs));
+ return request;
+ }
+
+ private Request createDeleteDocumentRequest(final DocumentDeleteOptions options, String path){
final DocumentDeleteOptions params = (options != null ? options : new DocumentDeleteOptions());
+ final Request request = request(db.dbName(), RequestType.DELETE, PATH_API_DOCUMENT, path);
+ request.putHeaderParam(ArangoRequestParam.IF_MATCH, params.getIfMatch());
request.putHeaderParam(TRANSACTION_ID, params.getStreamTransactionId());
request.putQueryParam(ArangoRequestParam.WAIT_FOR_SYNC, params.getWaitForSync());
request.putQueryParam(RETURN_OLD, params.getReturnOld());
request.putQueryParam(SILENT, params.getSilent());
- request.setBody(getSerde().serialize(keys));
return request;
}
diff --git a/src/main/java/com/arangodb/util/RawBytes.java b/src/main/java/com/arangodb/util/RawBytes.java
index 82c9adaae..8e9aded1b 100644
--- a/src/main/java/com/arangodb/util/RawBytes.java
+++ b/src/main/java/com/arangodb/util/RawBytes.java
@@ -19,7 +19,7 @@
* The driver's {@link InternalSerde} supports serializing and deserializing to and from
* {@code RawBytes}.
*/
-public class RawBytes {
+public class RawBytes implements RawData {
private final byte[] value;
protected RawBytes(final byte[] value) {
diff --git a/src/main/java/com/arangodb/util/RawData.java b/src/main/java/com/arangodb/util/RawData.java
new file mode 100644
index 000000000..610ec7827
--- /dev/null
+++ b/src/main/java/com/arangodb/util/RawData.java
@@ -0,0 +1,17 @@
+package com.arangodb.util;
+
+/**
+ * Wrapper for raw data, current implementations are:
+ * - {@link RawBytes}
+ * - {@link RawJson}
+ */
+public interface RawData {
+ static RawJson of(final String value) {
+ return RawJson.of(value);
+ }
+
+ static RawBytes of(final byte[] value) {
+ return RawBytes.of(value);
+ }
+
+}
diff --git a/src/main/java/com/arangodb/util/RawJson.java b/src/main/java/com/arangodb/util/RawJson.java
index 45bad862d..3642af973 100644
--- a/src/main/java/com/arangodb/util/RawJson.java
+++ b/src/main/java/com/arangodb/util/RawJson.java
@@ -13,7 +13,7 @@
* The driver's {@link InternalSerde} supports serializing and deserializing to and from
* {@code RawJson}.
*/
-public class RawJson {
+public class RawJson implements RawData {
private final String value;
protected RawJson(final String value) {
diff --git a/src/test/java/com/arangodb/ArangoCollectionTest.java b/src/test/java/com/arangodb/ArangoCollectionTest.java
index ca0c813c3..0c3df4279 100644
--- a/src/test/java/com/arangodb/ArangoCollectionTest.java
+++ b/src/test/java/com/arangodb/ArangoCollectionTest.java
@@ -21,15 +21,18 @@
package com.arangodb;
import com.arangodb.entity.*;
+import com.arangodb.internal.serde.SerdeUtils;
import com.arangodb.model.*;
import com.arangodb.model.DocumentImportOptions.OnDuplicate;
import com.arangodb.serde.JacksonSerde;
import com.arangodb.util.MapBuilder;
import com.arangodb.util.RawBytes;
+import com.arangodb.util.RawData;
import com.arangodb.util.RawJson;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.ObjectMapper;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Disabled;
@@ -1904,6 +1907,42 @@ void insertDocumentsJson(ArangoCollection collection) {
assertThat(docs.getErrors()).isEmpty();
}
+ @ParameterizedTest(name = "{index}")
+ @MethodSource("cols")
+ void insertDocumentsRawData(ArangoCollection collection) {
+ final RawData values = RawData.of("[{},{},{}]");
+ final MultiDocumentEntity> docs = collection.insertDocuments(values);
+ assertThat(docs).isNotNull();
+ assertThat(docs.getDocuments()).isNotNull();
+ assertThat(docs.getDocuments()).hasSize(3);
+ assertThat(docs.getErrors()).isNotNull();
+ assertThat(docs.getErrors()).isEmpty();
+ }
+
+ @ParameterizedTest(name = "{index}")
+ @MethodSource("cols")
+ void insertDocumentsRawDataReturnNew(ArangoCollection collection) {
+ final RawData values = RawData.of("[{\"aaa\":33},{\"aaa\":33},{\"aaa\":33}]");
+ final MultiDocumentEntity> docs =
+ collection.insertDocuments(values, new DocumentCreateOptions().returnNew(true));
+ assertThat(docs).isNotNull();
+ assertThat(docs.getDocuments()).isNotNull();
+ assertThat(docs.getDocuments()).hasSize(3);
+ assertThat(docs.getErrors()).isNotNull();
+ assertThat(docs.getErrors()).isEmpty();
+
+ for (final DocumentCreateEntity doc : docs.getDocuments()) {
+ RawData d = doc.getNew();
+ assertThat(d)
+ .isNotNull()
+ .isInstanceOf(RawJson.class);
+
+ JsonNode jn = SerdeUtils.INSTANCE.parseJson(((RawJson) d).getValue());
+ assertThat(jn.has("aaa")).isTrue();
+ assertThat(jn.get("aaa").intValue()).isEqualTo(33);
+ }
+ }
+
@ParameterizedTest(name = "{index}")
@MethodSource("cols")
void insertDocumentsOne(ArangoCollection collection) {
@@ -2175,7 +2214,7 @@ void importDocumentsFromToPrefix(ArangoCollection edgeCollection) {
void importDocumentsJson(ArangoCollection collection) throws JsonProcessingException {
final String values = mapper.writeValueAsString(Arrays.asList(Collections.singletonMap("_key", rnd()), Collections.singletonMap("_key", rnd())));
- final DocumentImportEntity docs = collection.importDocuments(values);
+ final DocumentImportEntity docs = collection.importDocuments(RawData.of(values));
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
assertThat(docs.getEmpty()).isZero();
@@ -2193,7 +2232,7 @@ void importDocumentsJsonDuplicateDefaultError(ArangoCollection collection) throw
final String values = mapper.writeValueAsString(Arrays.asList(Collections.singletonMap("_key", k1), Collections.singletonMap("_key", k2), Collections.singletonMap("_key", k2)));
- final DocumentImportEntity docs = collection.importDocuments(values);
+ final DocumentImportEntity docs = collection.importDocuments(RawData.of(values));
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
assertThat(docs.getEmpty()).isZero();
@@ -2211,7 +2250,7 @@ void importDocumentsJsonDuplicateError(ArangoCollection collection) throws JsonP
final String values = mapper.writeValueAsString(Arrays.asList(Collections.singletonMap("_key", k1), Collections.singletonMap("_key", k2), Collections.singletonMap("_key", k2)));
- final DocumentImportEntity docs = collection.importDocuments(values, new DocumentImportOptions().onDuplicate(OnDuplicate.error));
+ final DocumentImportEntity docs = collection.importDocuments(RawData.of(values), new DocumentImportOptions().onDuplicate(OnDuplicate.error));
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
assertThat(docs.getEmpty()).isZero();
@@ -2228,7 +2267,7 @@ void importDocumentsJsonDuplicateIgnore(ArangoCollection collection) throws Json
String k2 = rnd();
final String values = mapper.writeValueAsString(Arrays.asList(Collections.singletonMap("_key", k1), Collections.singletonMap("_key", k2), Collections.singletonMap("_key", k2)));
- final DocumentImportEntity docs = collection.importDocuments(values, new DocumentImportOptions().onDuplicate(OnDuplicate.ignore));
+ final DocumentImportEntity docs = collection.importDocuments(RawData.of(values), new DocumentImportOptions().onDuplicate(OnDuplicate.ignore));
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
assertThat(docs.getEmpty()).isZero();
@@ -2246,7 +2285,7 @@ void importDocumentsJsonDuplicateReplace(ArangoCollection collection) throws Jso
final String values = mapper.writeValueAsString(Arrays.asList(Collections.singletonMap("_key", k1), Collections.singletonMap("_key", k2), Collections.singletonMap("_key", k2)));
- final DocumentImportEntity docs = collection.importDocuments(values, new DocumentImportOptions().onDuplicate(OnDuplicate.replace));
+ final DocumentImportEntity docs = collection.importDocuments(RawData.of(values), new DocumentImportOptions().onDuplicate(OnDuplicate.replace));
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
assertThat(docs.getEmpty()).isZero();
@@ -2264,7 +2303,7 @@ void importDocumentsJsonDuplicateUpdate(ArangoCollection collection) throws Json
final String values = mapper.writeValueAsString(Arrays.asList(Collections.singletonMap("_key", k1), Collections.singletonMap("_key", k2), Collections.singletonMap("_key", k2)));
- final DocumentImportEntity docs = collection.importDocuments(values, new DocumentImportOptions().onDuplicate(OnDuplicate.update));
+ final DocumentImportEntity docs = collection.importDocuments(RawData.of(values), new DocumentImportOptions().onDuplicate(OnDuplicate.update));
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
assertThat(docs.getEmpty()).isZero();
@@ -2278,7 +2317,7 @@ void importDocumentsJsonDuplicateUpdate(ArangoCollection collection) throws Json
@MethodSource("cols")
void importDocumentsJsonCompleteFail(ArangoCollection collection) {
final String values = "[{\"_key\":\"1\"},{\"_key\":\"2\"},{\"_key\":\"2\"}]";
- Throwable thrown = catchThrowable(() -> collection.importDocuments(values, new DocumentImportOptions().complete(true)));
+ Throwable thrown = catchThrowable(() -> collection.importDocuments(RawData.of(values), new DocumentImportOptions().complete(true)));
assertThat(thrown).isInstanceOf(ArangoDBException.class);
ArangoDBException e = (ArangoDBException) thrown;
assertThat(e.getErrorNum()).isEqualTo(1210);
@@ -2292,7 +2331,7 @@ void importDocumentsJsonDetails(ArangoCollection collection) throws JsonProcessi
final String values = mapper.writeValueAsString(Arrays.asList(Collections.singletonMap("_key", k1), Collections.singletonMap("_key", k2), Collections.singletonMap("_key", k2)));
- final DocumentImportEntity docs = collection.importDocuments(values, new DocumentImportOptions().details(true));
+ final DocumentImportEntity docs = collection.importDocuments(RawData.of(values), new DocumentImportOptions().details(true));
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
assertThat(docs.getEmpty()).isZero();
@@ -2310,7 +2349,7 @@ void importDocumentsJsonOverwriteFalse(ArangoCollection collection) throws JsonP
Long initialCount = collection.count().getCount();
final String values = mapper.writeValueAsString(Arrays.asList(Collections.singletonMap("_key", rnd()), Collections.singletonMap("_key", rnd())));
- collection.importDocuments(values, new DocumentImportOptions().overwrite(false));
+ collection.importDocuments(RawData.of(values), new DocumentImportOptions().overwrite(false));
assertThat(collection.count().getCount()).isEqualTo(initialCount + 2L);
}
@@ -2320,7 +2359,7 @@ void importDocumentsJsonOverwriteTrue(ArangoCollection collection) throws JsonPr
collection.insertDocument(new BaseDocument());
final String values = mapper.writeValueAsString(Arrays.asList(Collections.singletonMap("_key", rnd()), Collections.singletonMap("_key", rnd())));
- collection.importDocuments(values, new DocumentImportOptions().overwrite(true));
+ collection.importDocuments(RawData.of(values), new DocumentImportOptions().overwrite(true));
assertThat(collection.count().getCount()).isEqualTo(2L);
}
@@ -2334,7 +2373,7 @@ void importDocumentsJsonFromToPrefix(ArangoCollection edgeCollection) throws Jso
final String values = mapper.writeValueAsString(Arrays.asList(new MapBuilder().put("_key", k1).put("_from", "from").put("_to", "to").get(), new MapBuilder().put("_key", k2).put("_from", "from").put("_to", "to").get()));
- final DocumentImportEntity importResult = edgeCollection.importDocuments(values, new DocumentImportOptions().fromPrefix("foo").toPrefix("bar"));
+ final DocumentImportEntity importResult = edgeCollection.importDocuments(RawData.of(values), new DocumentImportOptions().fromPrefix("foo").toPrefix("bar"));
assertThat(importResult).isNotNull();
assertThat(importResult.getCreated()).isEqualTo(2);
for (String key : keys) {
@@ -2372,6 +2411,25 @@ void deleteDocumentsByKey(ArangoCollection collection) {
assertThat(deleteResult.getErrors()).isEmpty();
}
+ @ParameterizedTest(name = "{index}")
+ @MethodSource("cols")
+ void deleteDocumentsRawDataByKeyReturnOld(ArangoCollection collection) {
+ final RawData values = RawData.of("[{\"_key\":\"1\"},{\"_key\":\"2\"}]");
+ collection.insertDocuments(values);
+ final RawData keys = RawData.of("[\"1\",\"2\"]");
+ MultiDocumentEntity> deleteResult = collection.deleteDocuments(keys,
+ new DocumentDeleteOptions().returnOld(true));
+ assertThat(deleteResult).isNotNull();
+ assertThat(deleteResult.getDocuments()).hasSize(2);
+ for (final DocumentDeleteEntity i : deleteResult.getDocuments()) {
+ assertThat(i.getKey()).isIn("1", "2");
+ assertThat(i.getOld()).isNotNull().isInstanceOf(RawJson.class);
+ JsonNode jn = SerdeUtils.INSTANCE.parseJson(((RawJson) i.getOld()).getValue());
+ assertThat(jn.get("_key").asText()).isEqualTo(i.getKey());
+ }
+ assertThat(deleteResult.getErrors()).isEmpty();
+ }
+
@ParameterizedTest(name = "{index}")
@MethodSource("cols")
void deleteDocumentsByDocuments(ArangoCollection collection) {
@@ -2578,6 +2636,41 @@ void updateDocumentsJson(ArangoCollection collection) {
assertThat(updateResult.getErrors()).isEmpty();
}
+ @ParameterizedTest(name = "{index}")
+ @MethodSource("cols")
+ void updateDocumentsRawData(ArangoCollection collection) {
+ final RawData values = RawData.of("[{\"_key\":\"1\"}, {\"_key\":\"2\"}]");
+ collection.insertDocuments(values);
+
+ final RawData updatedValues = RawData.of("[{\"_key\":\"1\", \"foo\":\"bar\"}, {\"_key\":\"2\", \"foo\":\"bar\"}]");
+ final MultiDocumentEntity> updateResult = collection.updateDocuments(updatedValues);
+ assertThat(updateResult.getDocuments()).hasSize(2);
+ assertThat(updateResult.getErrors()).isEmpty();
+ }
+
+ @ParameterizedTest(name = "{index}")
+ @MethodSource("cols")
+ void updateDocumentsRawDataReturnNew(ArangoCollection collection) {
+ final RawData values = RawData.of("[{\"_key\":\"1\"}, {\"_key\":\"2\"}]");
+ collection.insertDocuments(values);
+
+ final RawData updatedValues = RawData.of("[{\"_key\":\"1\", \"foo\":\"bar\"}, {\"_key\":\"2\", \"foo\":\"bar\"}]");
+ MultiDocumentEntity> updateResult =
+ collection.updateDocuments(updatedValues, new DocumentUpdateOptions().returnNew(true));
+ assertThat(updateResult.getDocuments()).hasSize(2);
+ assertThat(updateResult.getErrors()).isEmpty();
+ for (DocumentUpdateEntity doc : updateResult.getDocuments()) {
+ RawData d = doc.getNew();
+ assertThat(d)
+ .isNotNull()
+ .isInstanceOf(RawJson.class);
+
+ JsonNode jn = SerdeUtils.INSTANCE.parseJson(((RawJson) d).getValue());
+ assertThat(jn.has("foo")).isTrue();
+ assertThat(jn.get("foo").textValue()).isEqualTo("bar");
+ }
+ }
+
@ParameterizedTest(name = "{index}")
@MethodSource("cols")
void replaceDocuments(ArangoCollection collection) {
@@ -2660,6 +2753,41 @@ void replaceDocumentsJson(ArangoCollection collection) {
assertThat(updateResult.getErrors()).isEmpty();
}
+ @ParameterizedTest(name = "{index}")
+ @MethodSource("cols")
+ void replaceDocumentsRawData(ArangoCollection collection) {
+ final RawData values = RawData.of("[{\"_key\":\"1\"}, {\"_key\":\"2\"}]");
+ collection.insertDocuments(values);
+
+ final RawData updatedValues = RawData.of("[{\"_key\":\"1\", \"foo\":\"bar\"}, {\"_key\":\"2\", \"foo\":\"bar\"}]");
+ final MultiDocumentEntity> updateResult = collection.replaceDocuments(updatedValues);
+ assertThat(updateResult.getDocuments()).hasSize(2);
+ assertThat(updateResult.getErrors()).isEmpty();
+ }
+
+ @ParameterizedTest(name = "{index}")
+ @MethodSource("cols")
+ void replaceDocumentsRawDataReturnNew(ArangoCollection collection) {
+ final RawData values = RawData.of("[{\"_key\":\"1\"}, {\"_key\":\"2\"}]");
+ collection.insertDocuments(values);
+
+ final RawData updatedValues = RawData.of("[{\"_key\":\"1\", \"foo\":\"bar\"}, {\"_key\":\"2\", \"foo\":\"bar\"}]");
+ MultiDocumentEntity> updateResult =
+ collection.replaceDocuments(updatedValues, new DocumentReplaceOptions().returnNew(true));
+ assertThat(updateResult.getDocuments()).hasSize(2);
+ assertThat(updateResult.getErrors()).isEmpty();
+ for (DocumentUpdateEntity doc : updateResult.getDocuments()) {
+ RawData d = doc.getNew();
+ assertThat(d)
+ .isNotNull()
+ .isInstanceOf(RawJson.class);
+
+ JsonNode jn = SerdeUtils.INSTANCE.parseJson(((RawJson) d).getValue());
+ assertThat(jn.has("foo")).isTrue();
+ assertThat(jn.get("foo").textValue()).isEqualTo("bar");
+ }
+ }
+
@ParameterizedTest(name = "{index}")
@MethodSource("cols")
void getInfo(ArangoCollection collection) {
diff --git a/src/test/java/com/arangodb/async/ArangoCollectionTest.java b/src/test/java/com/arangodb/async/ArangoCollectionTest.java
index 793e03e3c..b41d7613c 100644
--- a/src/test/java/com/arangodb/async/ArangoCollectionTest.java
+++ b/src/test/java/com/arangodb/async/ArangoCollectionTest.java
@@ -20,19 +20,19 @@
package com.arangodb.async;
-import com.arangodb.ArangoCollection;
import com.arangodb.ArangoDBException;
import com.arangodb.entity.*;
+import com.arangodb.internal.serde.SerdeUtils;
import com.arangodb.model.*;
import com.arangodb.model.DocumentImportOptions.OnDuplicate;
import com.arangodb.serde.JacksonSerde;
+import com.arangodb.util.RawData;
import com.arangodb.util.RawJson;
import com.fasterxml.jackson.annotation.JsonTypeInfo;
+import com.fasterxml.jackson.databind.JsonNode;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
-import org.junit.jupiter.params.ParameterizedTest;
-import org.junit.jupiter.params.provider.MethodSource;
import java.util.*;
import java.util.concurrent.CompletableFuture;
@@ -1506,6 +1506,40 @@ void insertDocumentsFail() throws InterruptedException, ExecutionException {
.get();
}
+ @Test
+ void insertDocumentsRawData() throws ExecutionException, InterruptedException {
+ final RawData values = RawData.of("[{},{},{}]");
+ final MultiDocumentEntity> docs = db.collection(COLLECTION_NAME).insertDocuments(values).get();
+ assertThat(docs).isNotNull();
+ assertThat(docs.getDocuments()).isNotNull();
+ assertThat(docs.getDocuments()).hasSize(3);
+ assertThat(docs.getErrors()).isNotNull();
+ assertThat(docs.getErrors()).isEmpty();
+ }
+
+ @Test
+ void insertDocumentsRawDataReturnNew() throws ExecutionException, InterruptedException {
+ final RawData values = RawData.of("[{\"aaa\":33},{\"aaa\":33},{\"aaa\":33}]");
+ final MultiDocumentEntity> docs =
+ db.collection(COLLECTION_NAME).insertDocuments(values, new DocumentCreateOptions().returnNew(true)).get();
+ assertThat(docs).isNotNull();
+ assertThat(docs.getDocuments()).isNotNull();
+ assertThat(docs.getDocuments()).hasSize(3);
+ assertThat(docs.getErrors()).isNotNull();
+ assertThat(docs.getErrors()).isEmpty();
+
+ for (final DocumentCreateEntity doc : docs.getDocuments()) {
+ RawData d = doc.getNew();
+ assertThat(d)
+ .isNotNull()
+ .isInstanceOf(RawJson.class);
+
+ JsonNode jn = SerdeUtils.INSTANCE.parseJson(((RawJson) d).getValue());
+ assertThat(jn.has("aaa")).isTrue();
+ assertThat(jn.get("aaa").intValue()).isEqualTo(33);
+ }
+ }
+
@Test
void importDocuments() throws InterruptedException, ExecutionException {
final Collection values = new ArrayList<>();
@@ -1712,7 +1746,7 @@ void importDocumentsFromToPrefix() throws InterruptedException, ExecutionExcepti
@Test
void importDocumentsJson() throws InterruptedException, ExecutionException {
final String values = "[{\"_key\":\"1\"},{\"_key\":\"2\"}]";
- db.collection(COLLECTION_NAME).importDocuments(values)
+ db.collection(COLLECTION_NAME).importDocuments(RawData.of(values))
.whenComplete((docs, ex) -> {
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
@@ -1728,7 +1762,7 @@ void importDocumentsJson() throws InterruptedException, ExecutionException {
@Test
void importDocumentsJsonDuplicateDefaultError() throws InterruptedException, ExecutionException {
final String values = "[{\"_key\":\"1\"},{\"_key\":\"2\"},{\"_key\":\"2\"}]";
- db.collection(COLLECTION_NAME).importDocuments(values)
+ db.collection(COLLECTION_NAME).importDocuments(RawData.of(values))
.whenComplete((docs, ex) -> {
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
@@ -1744,7 +1778,7 @@ void importDocumentsJsonDuplicateDefaultError() throws InterruptedException, Exe
@Test
void importDocumentsJsonDuplicateError() throws InterruptedException, ExecutionException {
final String values = "[{\"_key\":\"1\"},{\"_key\":\"2\"},{\"_key\":\"2\"}]";
- db.collection(COLLECTION_NAME).importDocuments(values, new DocumentImportOptions().onDuplicate(OnDuplicate.error))
+ db.collection(COLLECTION_NAME).importDocuments(RawData.of(values), new DocumentImportOptions().onDuplicate(OnDuplicate.error))
.whenComplete((docs, ex) -> {
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
@@ -1760,7 +1794,7 @@ void importDocumentsJsonDuplicateError() throws InterruptedException, ExecutionE
@Test
void importDocumentsJsonDuplicateIgnore() throws InterruptedException, ExecutionException {
final String values = "[{\"_key\":\"1\"},{\"_key\":\"2\"},{\"_key\":\"2\"}]";
- db.collection(COLLECTION_NAME).importDocuments(values, new DocumentImportOptions().onDuplicate(OnDuplicate.ignore))
+ db.collection(COLLECTION_NAME).importDocuments(RawData.of(values), new DocumentImportOptions().onDuplicate(OnDuplicate.ignore))
.whenComplete((docs, ex) -> {
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
@@ -1776,7 +1810,7 @@ void importDocumentsJsonDuplicateIgnore() throws InterruptedException, Execution
@Test
void importDocumentsJsonDuplicateReplace() throws InterruptedException, ExecutionException {
final String values = "[{\"_key\":\"1\"},{\"_key\":\"2\"},{\"_key\":\"2\"}]";
- db.collection(COLLECTION_NAME).importDocuments(values, new DocumentImportOptions().onDuplicate(OnDuplicate.replace))
+ db.collection(COLLECTION_NAME).importDocuments(RawData.of(values), new DocumentImportOptions().onDuplicate(OnDuplicate.replace))
.whenComplete((docs, ex) -> {
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
@@ -1792,7 +1826,7 @@ void importDocumentsJsonDuplicateReplace() throws InterruptedException, Executio
@Test
void importDocumentsJsonDuplicateUpdate() throws InterruptedException, ExecutionException {
final String values = "[{\"_key\":\"1\"},{\"_key\":\"2\"},{\"_key\":\"2\"}]";
- db.collection(COLLECTION_NAME).importDocuments(values, new DocumentImportOptions().onDuplicate(OnDuplicate.update))
+ db.collection(COLLECTION_NAME).importDocuments(RawData.of(values), new DocumentImportOptions().onDuplicate(OnDuplicate.update))
.whenComplete((docs, ex) -> {
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
@@ -1809,7 +1843,7 @@ void importDocumentsJsonDuplicateUpdate() throws InterruptedException, Execution
void importDocumentsJsonCompleteFail() throws InterruptedException {
final String values = "[{\"_key\":\"1\"},{\"_key\":\"2\"},{\"_key\":\"2\"}]";
try {
- db.collection(COLLECTION_NAME).importDocuments(values, new DocumentImportOptions().complete(true)).get();
+ db.collection(COLLECTION_NAME).importDocuments(RawData.of(values), new DocumentImportOptions().complete(true)).get();
fail();
} catch (ExecutionException e) {
assertThat(e.getCause()).isInstanceOf(ArangoDBException.class);
@@ -1820,7 +1854,7 @@ void importDocumentsJsonCompleteFail() throws InterruptedException {
@Test
void importDocumentsJsonDetails() throws InterruptedException, ExecutionException {
final String values = "[{\"_key\":\"1\"},{\"_key\":\"2\"},{\"_key\":\"2\"}]";
- db.collection(COLLECTION_NAME).importDocuments(values, new DocumentImportOptions().details(true))
+ db.collection(COLLECTION_NAME).importDocuments(RawData.of(values), new DocumentImportOptions().details(true))
.whenComplete((docs, ex) -> {
assertThat(docs).isNotNull();
assertThat(docs.getCreated()).isEqualTo(2);
@@ -1841,7 +1875,7 @@ void importDocumentsJsonOverwriteFalse() throws InterruptedException, ExecutionE
assertThat(collection.count().get().getCount()).isEqualTo(1L);
final String values = "[{\"_key\":\"1\"},{\"_key\":\"2\"}]";
- collection.importDocuments(values, new DocumentImportOptions().overwrite(false)).get();
+ collection.importDocuments(RawData.of(values), new DocumentImportOptions().overwrite(false)).get();
assertThat(collection.count().get().getCount()).isEqualTo(3L);
}
@@ -1852,7 +1886,7 @@ void importDocumentsJsonOverwriteTrue() throws InterruptedException, ExecutionEx
assertThat(collection.count().get().getCount()).isEqualTo(1L);
final String values = "[{\"_key\":\"1\"},{\"_key\":\"2\"}]";
- collection.importDocuments(values, new DocumentImportOptions().overwrite(true)).get();
+ collection.importDocuments(RawData.of(values), new DocumentImportOptions().overwrite(true)).get();
assertThat(collection.count().get().getCount()).isEqualTo(2L);
}
@@ -1865,7 +1899,7 @@ void importDocumentsJsonFromToPrefix() throws InterruptedException, ExecutionExc
final String values = "[{\"_key\":\"1\",\"_from\":\"from\",\"_to\":\"to\"},{\"_key\":\"2\",\"_from\":\"from\",\"_to\":\"to\"}]";
final DocumentImportEntity importResult = collection
- .importDocuments(values, new DocumentImportOptions().fromPrefix("foo").toPrefix("bar")).get();
+ .importDocuments(RawData.of(values), new DocumentImportOptions().fromPrefix("foo").toPrefix("bar")).get();
assertThat(importResult).isNotNull();
assertThat(importResult.getCreated()).isEqualTo(2);
for (String key : keys) {
@@ -2031,6 +2065,26 @@ void deleteDocumentsByDocumentsNotExisting() throws InterruptedException, Execut
.get();
}
+ @Test
+ void deleteDocumentsRawDataByKeyReturnOld() throws ExecutionException, InterruptedException {
+ ArangoCollectionAsync collection = db.collection(COLLECTION_NAME);
+ final RawData values = RawData.of("[{\"_key\":\"1\"},{\"_key\":\"2\"}]");
+ collection.insertDocuments(values).get();
+ final RawData keys = RawData.of("[\"1\",\"2\"]");
+ MultiDocumentEntity> deleteResult = collection.deleteDocuments(keys,
+ new DocumentDeleteOptions().returnOld(true)).get();
+ assertThat(deleteResult).isNotNull();
+ assertThat(deleteResult.getDocuments()).hasSize(2);
+ for (final DocumentDeleteEntity i : deleteResult.getDocuments()) {
+ assertThat(i.getKey()).isIn("1", "2");
+ assertThat(i.getOld()).isNotNull().isInstanceOf(RawJson.class);
+ JsonNode jn = SerdeUtils.INSTANCE.parseJson(((RawJson) i.getOld()).getValue());
+ assertThat(jn.get("_key").asText()).isEqualTo(i.getKey());
+ }
+ assertThat(deleteResult.getErrors()).isEmpty();
+ }
+
+
@Test
void updateDocuments() throws InterruptedException, ExecutionException {
final Collection values = new ArrayList<>();
@@ -2142,6 +2196,41 @@ void updateDocumentsWithoutKey() throws InterruptedException, ExecutionException
.get();
}
+ @Test
+ void updateDocumentsRawData() throws ExecutionException, InterruptedException {
+ ArangoCollectionAsync collection = db.collection(COLLECTION_NAME);
+ final RawData values = RawData.of("[{\"_key\":\"1\"}, {\"_key\":\"2\"}]");
+ collection.insertDocuments(values).get();
+
+ final RawData updatedValues = RawData.of("[{\"_key\":\"1\", \"foo\":\"bar\"}, {\"_key\":\"2\", \"foo\":\"bar\"}]");
+ final MultiDocumentEntity> updateResult = collection.updateDocuments(updatedValues).get();
+ assertThat(updateResult.getDocuments()).hasSize(2);
+ assertThat(updateResult.getErrors()).isEmpty();
+ }
+
+ @Test
+ void updateDocumentsRawDataReturnNew() throws ExecutionException, InterruptedException {
+ ArangoCollectionAsync collection = db.collection(COLLECTION_NAME);
+ final RawData values = RawData.of("[{\"_key\":\"1\"}, {\"_key\":\"2\"}]");
+ collection.insertDocuments(values).get();
+
+ final RawData updatedValues = RawData.of("[{\"_key\":\"1\", \"foo\":\"bar\"}, {\"_key\":\"2\", \"foo\":\"bar\"}]");
+ MultiDocumentEntity> updateResult =
+ collection.updateDocuments(updatedValues, new DocumentUpdateOptions().returnNew(true)).get();
+ assertThat(updateResult.getDocuments()).hasSize(2);
+ assertThat(updateResult.getErrors()).isEmpty();
+ for (DocumentUpdateEntity doc : updateResult.getDocuments()) {
+ RawData d = doc.getNew();
+ assertThat(d)
+ .isNotNull()
+ .isInstanceOf(RawJson.class);
+
+ JsonNode jn = SerdeUtils.INSTANCE.parseJson(((RawJson) d).getValue());
+ assertThat(jn.has("foo")).isTrue();
+ assertThat(jn.get("foo").textValue()).isEqualTo("bar");
+ }
+ }
+
@Test
void replaceDocuments() throws InterruptedException, ExecutionException {
final Collection values = new ArrayList<>();
@@ -2216,6 +2305,44 @@ void replaceDocumentsWithoutKey() throws InterruptedException, ExecutionExceptio
.get();
}
+ @Test
+ void replaceDocumentsRawData() throws ExecutionException, InterruptedException {
+ ArangoCollectionAsync collection = db.collection(COLLECTION_NAME);
+
+ final RawData values = RawData.of("[{\"_key\":\"1\"}, {\"_key\":\"2\"}]");
+ collection.insertDocuments(values).get();
+
+ final RawData updatedValues = RawData.of("[{\"_key\":\"1\", \"foo\":\"bar\"}, {\"_key\":\"2\", \"foo\":\"bar\"}]");
+ final MultiDocumentEntity> updateResult = collection.replaceDocuments(updatedValues).get();
+ assertThat(updateResult.getDocuments()).hasSize(2);
+ assertThat(updateResult.getErrors()).isEmpty();
+ }
+
+ @Test
+ void replaceDocumentsRawDataReturnNew() throws ExecutionException, InterruptedException {
+ ArangoCollectionAsync collection = db.collection(COLLECTION_NAME);
+
+ final RawData values = RawData.of("[{\"_key\":\"1\"}, {\"_key\":\"2\"}]");
+ collection.insertDocuments(values).get();
+
+ final RawData updatedValues = RawData.of("[{\"_key\":\"1\", \"foo\":\"bar\"}, {\"_key\":\"2\", \"foo\":\"bar\"}]");
+ MultiDocumentEntity> updateResult =
+ collection.replaceDocuments(updatedValues, new DocumentReplaceOptions().returnNew(true)).get();
+ assertThat(updateResult.getDocuments()).hasSize(2);
+ assertThat(updateResult.getErrors()).isEmpty();
+ for (DocumentUpdateEntity doc : updateResult.getDocuments()) {
+ RawData d = doc.getNew();
+ assertThat(d)
+ .isNotNull()
+ .isInstanceOf(RawJson.class);
+
+ JsonNode jn = SerdeUtils.INSTANCE.parseJson(((RawJson) d).getValue());
+ assertThat(jn.has("foo")).isTrue();
+ assertThat(jn.get("foo").textValue()).isEqualTo("bar");
+ }
+ }
+
+
@Test
void getInfo() throws InterruptedException, ExecutionException {
db.collection(COLLECTION_NAME).getInfo()