HTTP interface for collections

The HTTP API for collections lets you create and delete collections, get information about collections, and modify certain properties of existing collections

Addresses of collections

All collections in ArangoDB have a unique identifier and a unique name. To access a collection, use the collection name to refer to it:

http://server:port/_api/collection/<collection-name>

For example, assume that the collection identifier is 7254820 and the collection name is demo, then the URL of that collection is:

http://localhost:8529/_api/collection/demo

Get information about collections

List all collections

GET /_db/{database-name}/_api/collection
Returns basic information for all collections in the current database, optionally excluding system collections.
Path Parameters
  • The name of the database.

Query Parameters
  • Whether system collections should be excluded from the result.

HTTP Headers
    Responses
    • The list of collections.

        Response Body application/json object
      • The HTTP response status code.

      • A flag indicating that no error occurred.

      • A list with every item holding basic collection metadata.

        • A unique identifier of the collection. This is an internal property.

        • A unique identifier of the collection (deprecated).

        • Whether the collection is a system collection. Collection names that starts with an underscore are usually system collections.

        • The name of the collection.

        • The status of the collection.

          • 3: loaded
          • 5: deleted

          Every other status indicates a corrupted collection.

        • The type of the collection:

          • 0: “unknown”
          • 2: regular document collection
          • 3: edge collection

    Examples

    Return information about all collections:

    curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection'
    Show output

    Get the collection information

    GET /_db/{database-name}/_api/collection/{collection-name}
    Returns the basic information about a specific collection.
    Path Parameters
    • The name of the database.

    • The name of the collection.

      Accessing collections by their numeric ID is deprecated from version 3.4.0 on. You should reference them via their names instead.

    Query Parameters
      HTTP Headers
        Responses
        • The basic information about a collection.

            Response Body application/json object
          • The HTTP response status code.

          • A flag indicating that no error occurred.

          • A unique identifier of the collection. This is an internal property.

          • A unique identifier of the collection (deprecated).

          • Whether the collection is a system collection. Collection names that starts with an underscore are usually system collections.

          • The name of the collection.

          • The status of the collection.

            • 3: loaded
            • 5: deleted

            Every other status indicates a corrupted collection.

          • The type of the collection:

            • 0: “unknown”
            • 2: regular document collection
            • 3: edge collection

        • The specified collection is unknown.

            Response Body application/json object
          • The HTTP response status code.

          • A flag indicating that an error occurred.

          • A descriptive error message.

          • The ArangoDB error number for the error that occurred.

        Get the properties of a collection

        GET /_db/{database-name}/_api/collection/{collection-name}/properties
        Returns all properties of the specified collection.
        Path Parameters
        • The name of the database.

        • The name of the collection.

          Accessing collections by their numeric ID is deprecated from version 3.4.0 on. You should reference them via their names instead.

        Query Parameters
          HTTP Headers
            Responses
            • All the collection properties.

                Response Body application/json object
              • Whether the in-memory hash cache for documents is enabled for this collection.

              • The HTTP response status code.

              • A list of objects, each representing a computed value.

                • An array of strings that defines on which write operations the value is computed.

                  Possible values: "insert", "update", "replace"

                • An AQL RETURN operation with an expression that computes the desired value.

                • Whether the write operation fails if the expression produces a warning.

                • Whether the target attribute is set if the expression evaluates to null.

                • The name of the target attribute.

                • Whether the computed value takes precedence over a user-provided or existing attribute.

              • The name of another collection. This collection uses the replicationFactor, numberOfShards and shardingStrategy properties of the other collection and the shards of this collection are distributed in the same way as the shards of the other collection.

              • A flag indicating that no error occurred.

              • A unique identifier of the collection. This is an internal property.

              • A unique identifier of the collection (deprecated).

              • Whether the SmartGraph or EnterpriseGraph this collection belongs to is disjoint (Enterprise Edition only). This is an internal property. (cluster only)

              • Whether the collection is used in a SmartGraph or EnterpriseGraph (Enterprise Edition only). This is an internal property. (cluster only)

              • Whether the collection is a system collection. Collection names that starts with an underscore are usually system collections.

              • An object which contains key generation options.

                • If set to true, then you are allowed to supply own key values in the _key attribute of a document. If set to false, then the key generator is solely responsible for generating keys and an error is raised if you supply own key values in the _key attribute of documents.

                  You should not use both user-specified and automatically generated document keys in the same collection in cluster deployments for collections with more than a single shard. Mixing the two can lead to conflicts because Coordinators that auto-generate keys in this case are not aware of all keys which are already used.

                • The increment value for the autoincrement key generator. Not used by other key generator types.

                • The offset value of the autoincrement or padded key generator. This is an internal property for restoring dumps properly.

                • The initial offset value for the autoincrement key generator. Not used by other key generator types.

                • Specifies the type of the key generator. Possible values:

                  • "traditional"
                  • "autoincrement"
                  • "uuid"
                  • "padded"

              • The name of this collection.

              • The number of shards of the collection. (cluster only)

              • Contains how many copies of each shard are kept on different DB-Servers. It is an integer number in the range of 1-10 or the string "satellite" for SatelliteCollections (Enterprise Edition only). (cluster only)

              • An object that specifies the collection-level schema for documents.

              • Contains the names of document attributes that are used to determine the target shard for documents. (cluster only)

              • The sharding strategy selected for the collection. (cluster only)

                Possible values:

                • "community-compat"
                • "enterprise-compat"
                • "enterprise-smart-edge-compat"
                • "hash"
                • "enterprise-hash-smart-edge"
                • "enterprise-hex-smart-vertex"

              • The attribute that is used for sharding: vertices with the same value of this attribute are placed in the same shard. All vertices are required to have this attribute set and it has to be a string. Edges derive the attribute from their connected vertices (Enterprise Edition only). (cluster only)

              • Determines an attribute of the collection that must contain the shard key value of the referred-to SmartJoin collection (Enterprise Edition only). (cluster only)

              • Whether the newer revision-based replication protocol is enabled for this collection. This is an internal property.

              • The type of the collection:

                • 0: “unknown”
                • 2: regular document collection
                • 3: edge collection

              • If true, creating, changing, or removing documents waits until the data has been synchronized to disk.

              • Determines how many copies of each shard are required to be in-sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of writeConcern cannot be greater than replicationFactor.

                If distributeShardsLike is set, the default writeConcern is that of the prototype collection. For SatelliteCollections, the writeConcern is automatically controlled to equal the number of DB-Servers and has a value of 0. Otherwise, the default value is controlled by the current database’s default writeConcern, which uses the --cluster.write-concern startup option as default, which defaults to 1. (cluster only)

            • If the collection-name placeholder is missing, then a HTTP 400 is returned.

            • If the collection is unknown, then a HTTP 404 is returned.

            Examples

            Using an identifier:

            curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/68431/properties'
            Show output

            Using a name:

            curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/products/properties'
            Show output

            Get the document count of a collection

            GET /_db/{database-name}/_api/collection/{collection-name}/count
            Get the number of documents in a collection.
            Path Parameters
            • The name of the database.

            • The name of the collection.

              Accessing collections by their numeric ID is deprecated from version 3.4.0 on. You should reference them via their names instead.

            Query Parameters
              HTTP Headers
              • To make this operation a part of a Stream Transaction, set this header to the transaction ID returned by the POST /_api/transaction/begin call.

              Responses
              • All properties of the collection but additionally the document count.

                  Response Body application/json object
                • Whether the in-memory hash cache for documents is enabled for this collection.

                • The HTTP response status code.

                • A list of objects, each representing a computed value.

                  • An array of strings that defines on which write operations the value is computed.

                    Possible values: "insert", "update", "replace"

                  • An AQL RETURN operation with an expression that computes the desired value.

                  • Whether the write operation fails if the expression produces a warning.

                  • Whether the target attribute is set if the expression evaluates to null.

                  • The name of the target attribute.

                  • Whether the computed value takes precedence over a user-provided or existing attribute.

                • The number of documents currently present in the collection.

                • The name of another collection. This collection uses the replicationFactor, numberOfShards and shardingStrategy properties of the other collection and the shards of this collection are distributed in the same way as the shards of the other collection.

                • A flag indicating that no error occurred.

                • A unique identifier of the collection. This is an internal property.

                • A unique identifier of the collection (deprecated).

                • Whether the SmartGraph or EnterpriseGraph this collection belongs to is disjoint (Enterprise Edition only). This is an internal property. (cluster only)

                • Whether the collection is used in a SmartGraph or EnterpriseGraph (Enterprise Edition only). This is an internal property. (cluster only)

                • Whether the collection is a system collection. Collection names that starts with an underscore are usually system collections.

                • An object which contains key generation options.

                  • If set to true, then you are allowed to supply own key values in the _key attribute of a document. If set to false, then the key generator is solely responsible for generating keys and an error is raised if you supply own key values in the _key attribute of documents.

                    You should not use both user-specified and automatically generated document keys in the same collection in cluster deployments for collections with more than a single shard. Mixing the two can lead to conflicts because Coordinators that auto-generate keys in this case are not aware of all keys which are already used.

                  • The increment value for the autoincrement key generator. Not used by other key generator types.

                  • The offset value of the autoincrement or padded key generator. This is an internal property for restoring dumps properly.

                  • The initial offset value for the autoincrement key generator. Not used by other key generator types.

                  • Specifies the type of the key generator. Possible values:

                    • "traditional"
                    • "autoincrement"
                    • "uuid"
                    • "padded"

                • The name of this collection.

                • The number of shards of the collection. (cluster only)

                • Contains how many copies of each shard are kept on different DB-Servers. It is an integer number in the range of 1-10 or the string "satellite" for SatelliteCollections (Enterprise Edition only). (cluster only)

                • An object that specifies the collection-level schema for documents.

                • Contains the names of document attributes that are used to determine the target shard for documents. (cluster only)

                • The sharding strategy selected for the collection. (cluster only)

                  Possible values:

                  • "community-compat"
                  • "enterprise-compat"
                  • "enterprise-smart-edge-compat"
                  • "hash"
                  • "enterprise-hash-smart-edge"
                  • "enterprise-hex-smart-vertex"

                • The attribute that is used for sharding: vertices with the same value of this attribute are placed in the same shard. All vertices are required to have this attribute set and it has to be a string. Edges derive the attribute from their connected vertices (Enterprise Edition only). (cluster only)

                • Determines an attribute of the collection that must contain the shard key value of the referred-to SmartJoin collection (Enterprise Edition only). (cluster only)

                • Whether the newer revision-based replication protocol is enabled for this collection. This is an internal property.

                • The type of the collection:

                  • 0: “unknown”
                  • 2: regular document collection
                  • 3: edge collection

                • If true, creating, changing, or removing documents waits until the data has been synchronized to disk.

                • Determines how many copies of each shard are required to be in-sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of writeConcern cannot be greater than replicationFactor.

                  If distributeShardsLike is set, the default writeConcern is that of the prototype collection. For SatelliteCollections, the writeConcern is automatically controlled to equal the number of DB-Servers and has a value of 0. Otherwise, the default value is controlled by the current database’s default writeConcern, which uses the --cluster.write-concern startup option as default, which defaults to 1. (cluster only)

              • If the collection-name placeholder is missing, then a HTTP 400 is returned.

              • If the collection is unknown, then a HTTP 404 is returned.

              Examples

              Requesting the number of documents:

              curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/products/count'
              Show output

              Get the collection statistics

              GET /_db/{database-name}/_api/collection/{collection-name}/figures
              Get the number of documents and additional statistical information about the collection.
              Path Parameters
              • The name of the database.

              • The name of the collection.

                Accessing collections by their numeric ID is deprecated from version 3.4.0 on. You should reference them via their names instead.

              Query Parameters
              • Setting details to true will return extended storage engine-specific details to the figures. The details are intended for debugging ArangoDB itself and their format is subject to change. By default, details is set to false, so no details are returned and the behavior is identical to previous versions of ArangoDB. Please note that requesting details may cause additional load and thus have an impact on performance.

              HTTP Headers
                Responses
                • All properties of the collection but additionally the document count and collection figures.

                    Response Body application/json object
                  • Whether the in-memory hash cache for documents is enabled for this collection.

                  • The HTTP response status code.

                  • A list of objects, each representing a computed value.

                    • An array of strings that defines on which write operations the value is computed.

                      Possible values: "insert", "update", "replace"

                    • An AQL RETURN operation with an expression that computes the desired value.

                    • Whether the write operation fails if the expression produces a warning.

                    • Whether the target attribute is set if the expression evaluates to null.

                    • The name of the target attribute.

                    • Whether the computed value takes precedence over a user-provided or existing attribute.

                  • The number of documents currently present in the collection.

                  • The name of another collection. This collection uses the replicationFactor, numberOfShards and shardingStrategy properties of the other collection and the shards of this collection are distributed in the same way as the shards of the other collection.

                  • A flag indicating that no error occurred.

                  • The metrics of the collection.

                    • The index metrics.

                      • The total number of indexes defined for the collection, including the pre-defined indexes (e.g. primary index).

                      • The total memory allocated for indexes in bytes.

                  • A unique identifier of the collection. This is an internal property.

                  • A unique identifier of the collection (deprecated).

                  • Whether the SmartGraph or EnterpriseGraph this collection belongs to is disjoint (Enterprise Edition only). This is an internal property. (cluster only)

                  • Whether the collection is used in a SmartGraph or EnterpriseGraph (Enterprise Edition only). This is an internal property. (cluster only)

                  • Whether the collection is a system collection. Collection names that starts with an underscore are usually system collections.

                  • An object which contains key generation options.

                    • If set to true, then you are allowed to supply own key values in the _key attribute of a document. If set to false, then the key generator is solely responsible for generating keys and an error is raised if you supply own key values in the _key attribute of documents.

                      You should not use both user-specified and automatically generated document keys in the same collection in cluster deployments for collections with more than a single shard. Mixing the two can lead to conflicts because Coordinators that auto-generate keys in this case are not aware of all keys which are already used.

                    • The increment value for the autoincrement key generator. Not used by other key generator types.

                    • The offset value of the autoincrement or padded key generator. This is an internal property for restoring dumps properly.

                    • The initial offset value for the autoincrement key generator. Not used by other key generator types.

                    • Specifies the type of the key generator. Possible values:

                      • "traditional"
                      • "autoincrement"
                      • "uuid"
                      • "padded"

                  • The name of this collection.

                  • The number of shards of the collection. (cluster only)

                  • Contains how many copies of each shard are kept on different DB-Servers. It is an integer number in the range of 1-10 or the string "satellite" for SatelliteCollections (Enterprise Edition only). (cluster only)

                  • An object that specifies the collection-level schema for documents.

                  • Contains the names of document attributes that are used to determine the target shard for documents. (cluster only)

                  • The sharding strategy selected for the collection. (cluster only)

                    Possible values:

                    • "community-compat"
                    • "enterprise-compat"
                    • "enterprise-smart-edge-compat"
                    • "hash"
                    • "enterprise-hash-smart-edge"
                    • "enterprise-hex-smart-vertex"

                  • The attribute that is used for sharding: vertices with the same value of this attribute are placed in the same shard. All vertices are required to have this attribute set and it has to be a string. Edges derive the attribute from their connected vertices (Enterprise Edition only). (cluster only)

                  • Determines an attribute of the collection that must contain the shard key value of the referred-to SmartJoin collection (Enterprise Edition only). (cluster only)

                  • Whether the newer revision-based replication protocol is enabled for this collection. This is an internal property.

                  • The type of the collection:

                    • 0: “unknown”
                    • 2: regular document collection
                    • 3: edge collection

                  • If true, creating, changing, or removing documents waits until the data has been synchronized to disk.

                  • Determines how many copies of each shard are required to be in-sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of writeConcern cannot be greater than replicationFactor.

                    If distributeShardsLike is set, the default writeConcern is that of the prototype collection. For SatelliteCollections, the writeConcern is automatically controlled to equal the number of DB-Servers and has a value of 0. Otherwise, the default value is controlled by the current database’s default writeConcern, which uses the --cluster.write-concern startup option as default, which defaults to 1. (cluster only)

                • The collection-name parameter is missing.

                    Response Body application/json object
                  • The HTTP response status code.

                  • A flag indicating that an error occurred.

                  • A descriptive error message.

                  • ArangoDB error number for the error that occurred.

                • A collection called collection-name could not be found.

                    Response Body application/json object
                  • The HTTP response status code.

                  • A flag indicating that an error occurred.

                  • A descriptive error message.

                  • ArangoDB error number for the error that occurred.

                Examples

                Using an identifier and requesting the figures of the collection:

                curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/products/figures'
                Show output

                curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/products/figures?details=true'
                Show output

                Get the responsible shard for a document

                PUT /_db/{database-name}/_api/collection/{collection-name}/responsibleShard

                Returns the ID of the shard that is responsible for the given document (if the document exists) or that would be responsible if such document existed.

                The request must body must contain a JSON document with at least the collection’s shard key attributes set to some values.

                The response is a JSON object with a shardId attribute, which will contain the ID of the responsible shard.

                This method is only available in cluster deployments on Coordinators.
                Path Parameters
                • The name of the database.

                • The name of the collection.

                Query Parameters
                  HTTP Headers
                    Request Body application/json object
                    • The request body must be a JSON object with at least the shard key attributes set to some values, but it may also be a full document.

                    Responses
                    • Returns the ID of the responsible shard.

                        Response Body application/json object
                      • The HTTP response status code.

                      • A flag indicating that no error occurred.

                      • The ID of the responsible shard

                    • The collection-name parameter is missing or not all of the collection’s shard key attributes are present in the input document.

                        Response Body application/json object
                      • The HTTP response status code.

                      • A flag indicating that an error occurred.

                      • A descriptive error message.

                      • ArangoDB error number for the error that occurred.

                    • A collection called collection-name could not be found.

                        Response Body application/json object
                      • The HTTP response status code.

                      • A flag indicating that an error occurred.

                      • A descriptive error message.

                      • ArangoDB error number for the error that occurred.

                    • The method has been called on a single server.

                        Response Body application/json object
                      • The HTTP response status code.

                      • A flag indicating that an error occurred.

                      • A descriptive error message.

                      • ArangoDB error number for the error that occurred.

                    Examples

                    curl -X PUT --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/collection/testCollection/responsibleShard' <<'EOF'
                    {
                      "_key": "testkey",
                      "value": 23
                    }
                    EOF
                    Show output

                    Get the shard IDs of a collection

                    GET /_db/{database-name}/_api/collection/{collection-name}/shards

                    Returns a JSON array with the shard IDs of the collection.

                    If the details parameter is set to true, it returns a JSON object with the shard IDs as object attribute keys, and the responsible servers for each shard mapped to them. In the detailed response, the leader shards come first in the arrays.

                    This method is only available in cluster deployments on Coordinators.
                    Path Parameters
                    • The name of the database.

                    • The name of the collection.

                    Query Parameters
                    • If set to true, the return value also contains the responsible servers for the collections’ shards.

                    HTTP Headers
                      Responses
                      • Returns the collection’s shards.

                      • The collection-name parameter is missing.

                          Response Body application/json object
                        • The HTTP response status code.

                        • A flag indicating that an error occurred.

                        • A descriptive error message.

                        • ArangoDB error number for the error that occurred.

                      • A collection called collection-name could not be found.

                          Response Body application/json object
                        • The HTTP response status code.

                        • A flag indicating that an error occurred.

                        • A descriptive error message.

                        • ArangoDB error number for the error that occurred.

                      • The method has been called on a single server.

                          Response Body application/json object
                        • The HTTP response status code.

                        • A flag indicating that an error occurred.

                        • A descriptive error message.

                        • ArangoDB error number for the error that occurred.

                      Examples

                      Retrieves the list of shards:

                      curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/testCollection/shards'
                      Show output

                      Retrieves the list of shards with the responsible servers:

                      curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/testCollection/shards?details=true'
                      Show output

                      Get the collection revision ID

                      GET /_db/{database-name}/_api/collection/{collection-name}/revision
                      The response contains the collection’s latest used revision ID. The revision ID is a server-generated string that clients can use to check whether data in a collection has changed since the last revision check.
                      Path Parameters
                      • The name of the database.

                      • The name of the collection.

                        Accessing collections by their numeric ID is deprecated from version 3.4.0 on. You should reference them via their names instead.

                      Query Parameters
                        HTTP Headers
                          Responses
                          • All collection properties but additionally the collection revision.

                              Response Body application/json object
                            • Whether the in-memory hash cache for documents is enabled for this collection.

                            • The HTTP response status code.

                            • A list of objects, each representing a computed value.

                              • An array of strings that defines on which write operations the value is computed.

                                Possible values: "insert", "update", "replace"

                              • An AQL RETURN operation with an expression that computes the desired value.

                              • Whether the write operation fails if the expression produces a warning.

                              • Whether the target attribute is set if the expression evaluates to null.

                              • The name of the target attribute.

                              • Whether the computed value takes precedence over a user-provided or existing attribute.

                            • The name of another collection. This collection uses the replicationFactor, numberOfShards and shardingStrategy properties of the other collection and the shards of this collection are distributed in the same way as the shards of the other collection.

                            • A flag indicating that no error occurred.

                            • A unique identifier of the collection. This is an internal property.

                            • A unique identifier of the collection (deprecated).

                            • Whether the SmartGraph or EnterpriseGraph this collection belongs to is disjoint (Enterprise Edition only). This is an internal property. (cluster only)

                            • Whether the collection is used in a SmartGraph or EnterpriseGraph (Enterprise Edition only). This is an internal property. (cluster only)

                            • Whether the collection is a system collection. Collection names that starts with an underscore are usually system collections.

                            • An object which contains key generation options.

                              • If set to true, then you are allowed to supply own key values in the _key attribute of a document. If set to false, then the key generator is solely responsible for generating keys and an error is raised if you supply own key values in the _key attribute of documents.

                                You should not use both user-specified and automatically generated document keys in the same collection in cluster deployments for collections with more than a single shard. Mixing the two can lead to conflicts because Coordinators that auto-generate keys in this case are not aware of all keys which are already used.

                              • The increment value for the autoincrement key generator. Not used by other key generator types.

                              • The offset value of the autoincrement or padded key generator. This is an internal property for restoring dumps properly.

                              • The initial offset value for the autoincrement key generator. Not used by other key generator types.

                              • Specifies the type of the key generator. Possible values:

                                • "traditional"
                                • "autoincrement"
                                • "uuid"
                                • "padded"

                            • The name of this collection.

                            • The number of shards of the collection. (cluster only)

                            • Contains how many copies of each shard are kept on different DB-Servers. It is an integer number in the range of 1-10 or the string "satellite" for SatelliteCollections (Enterprise Edition only). (cluster only)

                            • The collection revision ID as a string.

                            • An object that specifies the collection-level schema for documents.

                            • Contains the names of document attributes that are used to determine the target shard for documents. (cluster only)

                            • The sharding strategy selected for the collection. (cluster only)

                              Possible values:

                              • "community-compat"
                              • "enterprise-compat"
                              • "enterprise-smart-edge-compat"
                              • "hash"
                              • "enterprise-hash-smart-edge"
                              • "enterprise-hex-smart-vertex"

                            • The attribute that is used for sharding: vertices with the same value of this attribute are placed in the same shard. All vertices are required to have this attribute set and it has to be a string. Edges derive the attribute from their connected vertices (Enterprise Edition only). (cluster only)

                            • Determines an attribute of the collection that must contain the shard key value of the referred-to SmartJoin collection (Enterprise Edition only). (cluster only)

                            • Whether the newer revision-based replication protocol is enabled for this collection. This is an internal property.

                            • The type of the collection:

                              • 0: “unknown”
                              • 2: regular document collection
                              • 3: edge collection

                            • If true, creating, changing, or removing documents waits until the data has been synchronized to disk.

                            • Determines how many copies of each shard are required to be in-sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of writeConcern cannot be greater than replicationFactor.

                              If distributeShardsLike is set, the default writeConcern is that of the prototype collection. For SatelliteCollections, the writeConcern is automatically controlled to equal the number of DB-Servers and has a value of 0. Otherwise, the default value is controlled by the current database’s default writeConcern, which uses the --cluster.write-concern startup option as default, which defaults to 1. (cluster only)

                          • The collection-name parameter is missing.

                              Response Body application/json object
                            • The HTTP response status code.

                            • A flag indicating that an error occurred.

                            • A descriptive error message.

                            • ArangoDB error number for the error that occurred.

                          • A collection called collection-name could not be found.

                              Response Body application/json object
                            • The HTTP response status code.

                            • A flag indicating that an error occurred.

                            • A descriptive error message.

                            • ArangoDB error number for the error that occurred.

                          Examples

                          Retrieving the revision of a collection

                          curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/products/revision'
                          Show output

                          Get the collection checksum

                          GET /_db/{database-name}/_api/collection/{collection-name}/checksum

                          Calculates a checksum of the meta-data (keys and optionally revision ids) and optionally the document data in the collection.

                          The checksum can be used to compare if two collections on different ArangoDB instances contain the same contents. The current revision of the collection is returned too so one can make sure the checksums are calculated for the same state of data.

                          By default, the checksum is only calculated on the _key system attribute of the documents contained in the collection. For edge collections, the system attributes _from and _to are also included in the calculation.

                          By setting the optional query parameter withRevisions to true, then revision IDs (_rev system attributes) are included in the checksumming.

                          By providing the optional query parameter withData with a value of true, the user-defined document attributes are included in the calculation, too.

                          Including user-defined attributes will make the checksumming slower.
                          Path Parameters
                          • The name of the database.

                          • The name of the collection.

                            Accessing collections by their numeric ID is deprecated from version 3.4.0 on. You should reference them via their names instead.

                          Query Parameters
                          • Whether or not to include document revision ids in the checksum calculation.

                          • Whether or not to include document body data in the checksum calculation.

                          HTTP Headers
                            Responses
                            • The basic information about the collection but additionally the collection checksum and revision.

                                Response Body application/json object
                              • The calculated checksum as a number.

                              • The HTTP response status code.

                              • A flag indicating that no error occurred.

                              • A unique identifier of the collection. This is an internal property.

                              • A unique identifier of the collection (deprecated).

                              • Whether the collection is a system collection. Collection names that starts with an underscore are usually system collections.

                              • The name of the collection.

                              • The collection revision id as a string.

                              • The status of the collection.

                                • 3: loaded
                                • 5: deleted

                                Every other status indicates a corrupted collection.

                              • The type of the collection:

                                • 0: “unknown”
                                • 2: regular document collection
                                • 3: edge collection

                            • If the collection-name placeholder is missing, then a HTTP 400 is returned.

                            • If the collection is unknown, then a HTTP 404 is returned.

                            Examples

                            Retrieving the checksum of a collection:

                            curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/products/checksum'
                            Show output

                            Retrieving the checksum of a collection including the collection data, but not the revisions:

                            curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/products/checksum?withRevisions=false&withData=true'
                            Show output

                            Get the available key generators

                            GET /_db/{database-name}/_api/key-generators
                            Returns the available key generators for collections.
                            Path Parameters
                            • The name of a database. Which database you use doesn’t matter as long as the user account you authenticate with has at least read access to this database.

                            Query Parameters
                              HTTP Headers
                                Responses
                                • An object that contains a list of the available generators for document keys.

                                    Response Body application/json object
                                  • The available document key generators.

                                    Possible values: "padded", "uuid", "autoincrement", "traditional"

                                Examples:

                                Retrieving the key generators for collections:

                                curl --header 'accept: application/json' --dump - 'http://localhost:8529/_api/key-generators'
                                Show output

                                Create and delete collections

                                Create a collection

                                POST /_db/{database-name}/_api/collection
                                Creates a new collection with a given name. The request must contain an object with the following attributes.
                                Path Parameters
                                • The name of the database.

                                Query Parameters
                                • The default is true, which means the server only reports success back to the client when all replicas have created the collection. Set it to false if you want faster server responses and don’t care about full replication.

                                • The default is true, which means the server checks if there are enough replicas available at creation time and bail out otherwise. Set it to false to disable this extra check.

                                HTTP Headers
                                  Request Body application/json object
                                  • Whether the in-memory hash cache for documents should be enabled for this collection. Can be controlled globally with the --cache.size startup option. The cache can speed up repeated reads of the same documents via their document keys. If the same documents are not fetched often or are modified frequently, then you may disable the cache to avoid the maintenance costs.

                                  • An optional list of objects, each representing a computed value.

                                    • An array of strings to define on which write operations the value shall be computed.

                                      Possible values: "insert", "update", "replace"

                                    • An AQL RETURN operation with an expression that computes the desired value. See Computed Value Expressions for details.

                                    • Whether to let the write operation fail if the expression produces a warning.

                                    • Whether the target attribute shall be set if the expression evaluates to null. You can set the option to false to not set (or unset) the target attribute if the expression returns null.

                                    • The name of the target attribute. Can only be a top-level attribute, but you may return a nested object. Cannot be _key, _id, _rev, _from, _to, or a shard key attribute.

                                    • Whether the computed value shall take precedence over a user-provided or existing attribute.

                                  • The name of another collection. If this property is set in a cluster, the collection copies the replicationFactor, numberOfShards and shardingStrategy properties from the specified collection (referred to as the prototype collection) and distributes the shards of this collection in the same way as the shards of the other collection. In an Enterprise Edition cluster, this data co-location is utilized to optimize queries.

                                    You need to use the same number of shardKeys as the prototype collection, but you can use different attributes.

                                    Using this parameter has consequences for the prototype collection. It can no longer be dropped, before the sharding-imitating collections are dropped. Equally, backups and restores of imitating collections alone generate warnings (which can be overridden) about a missing sharding prototype.

                                  • Whether the collection is for a Disjoint SmartGraph (Enterprise Edition only). This is an internal property.

                                  • Whether the collection is for a SmartGraph or EnterpriseGraph (Enterprise Edition only). This is an internal property.

                                  • If true, create a system collection. In this case, the collection-name should start with an underscore. End-users should normally create non-system collections only. API implementors may be required to create system collections in very special occasions, but normally a regular collection will do.

                                  • additional options for key generation. If specified, then keyOptions should be a JSON object containing the following attributes:

                                    • If set to true, then you are allowed to supply own key values in the _key attribute of documents. If set to false, then the key generator is solely responsible for generating keys and an error is raised if you supply own key values in the _key attribute of documents.

                                      You should not use both user-specified and automatically generated document keys in the same collection in cluster deployments for collections with more than a single shard. Mixing the two can lead to conflicts because Coordinators that auto-generate keys in this case are not aware of all keys which are already used.

                                    • The increment value for the autoincrement key generator. Not allowed for other key generator types.

                                    • The initial offset value for the autoincrement key generator. Not allowed for other key generator types.

                                    • specifies the type of the key generator. The currently available generators are traditional, autoincrement, uuid and padded.

                                      • The traditional key generator generates numerical keys in ascending order. The sequence of keys is not guaranteed to be gap-free.

                                      • The autoincrement key generator generates numerical keys in ascending order, the initial offset and the spacing can be configured (note: autoincrement is currently only supported for non-sharded collections). The sequence of generated keys is not guaranteed to be gap-free, because a new key will be generated on every document insert attempt, not just for successful inserts.

                                      • The padded key generator generates keys of a fixed length (16 bytes) in ascending lexicographical sort order. This is ideal for the RocksDB storage engine, which will slightly benefit keys that are inserted in lexicographically ascending order. The key generator can be used in a single-server or cluster. The sequence of generated keys is not guaranteed to be gap-free.

                                      • The uuid key generator generates universally unique 128 bit keys, which are stored in hexadecimal human-readable format. This key generator can be used in a single-server or cluster to generate “seemingly random” keys. The keys produced by this key generator are not lexicographically sorted.

                                      Please note that keys are only guaranteed to be truly ascending in single server deployments and for collections that only have a single shard (that includes collections in a OneShard database). The reason is that for collections with more than a single shard, document keys are generated on Coordinator(s). For collections with a single shard, the document keys are generated on the leader DB-Server, which has full control over the key sequence.

                                  • The name of the collection.

                                  • In a cluster, this value determines the number of shards to create for the collection.

                                  • In a cluster, this attribute determines how many copies of each shard are kept on different DB-Servers. The value 1 means that only one copy (no synchronous replication) is kept. A value of k means that k-1 replicas are kept. For SatelliteCollections, it needs to be the string "satellite", which matches the replication factor to the number of DB-Servers (Enterprise Edition only).

                                    Any two copies reside on different DB-Servers. Replication between them is synchronous, that is, every write operation to the “leader” copy will be replicated to all “follower” replicas, before the write operation is reported successful.

                                    If a server fails, this is detected automatically and one of the servers holding copies take over, usually without an error being reported.

                                  • Optional object that specifies the collection level schema for documents. The attribute keys rule, level and message must follow the rules documented in Document Schema Validation

                                  • In a cluster, this attribute determines which document attributes are used to determine the target shard for documents. Documents are sent to shards based on the values of their shard key attributes. The values of all shard key attributes in a document are hashed, and the hash value is used to determine the target shard.

                                    Values of shard key attributes cannot be changed once set.

                                  • This attribute specifies the name of the sharding strategy to use for the collection. There are different sharding strategies to select from when creating a new collection. The selected shardingStrategy value remains fixed for the collection and cannot be changed afterwards. This is important to make the collection keep its sharding settings and always find documents already distributed to shards using the same initial sharding algorithm.

                                    The available sharding strategies are:

                                    • community-compat: default sharding used by ArangoDB Community Edition before version 3.4
                                    • enterprise-compat: default sharding used by ArangoDB Enterprise Edition before version 3.4
                                    • enterprise-smart-edge-compat: default sharding used by smart edge collections in ArangoDB Enterprise Edition before version 3.4
                                    • hash: default sharding used for new collections starting from version 3.4 (excluding smart edge collections)
                                    • enterprise-hash-smart-edge: default sharding used for new smart edge collections starting from version 3.4
                                    • enterprise-hex-smart-vertex: sharding used for vertex collections of EnterpriseGraphs

                                    If no sharding strategy is specified, the default is hash for all normal collections, enterprise-hash-smart-edge for all smart edge collections, and enterprise-hex-smart-vertex for EnterpriseGraph vertex collections (the latter two require the Enterprise Edition of ArangoDB). Manually overriding the sharding strategy does not yet provide a benefit, but it may later in case other sharding strategies are added.

                                  • The attribute that is used for sharding: vertices with the same value of this attribute are placed in the same shard. All vertices are required to have this attribute set and it has to be a string. Edges derive the attribute from their connected vertices.

                                    This feature can only be used in the Enterprise Edition.

                                  • In an Enterprise Edition cluster, this attribute determines an attribute of the collection that must contain the shard key value of the referred-to SmartJoin collection. Additionally, the shard key for a document in this collection must contain the value of this attribute, followed by a colon, followed by the actual primary key of the document.

                                    This feature can only be used in the Enterprise Edition and requires the distributeShardsLike attribute of the collection to be set to the name of another collection. It also requires the shardKeys attribute of the collection to be set to a single shard key attribute, with an additional ‘:’ at the end. A further restriction is that whenever documents are stored or updated in the collection, the value stored in the smartJoinAttribute must be a string.

                                  • The type of the collection to create. The following values for type are valid:

                                    • 2: document collection
                                    • 3: edge collection

                                  • If set to true, then the data is synchronized to disk before returning from a document create, update, replace or removal operation.

                                  • Determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of writeConcern cannot be greater than replicationFactor.

                                    If distributeShardsLike is set, the default writeConcern is that of the prototype collection. For SatelliteCollections, the writeConcern is automatically controlled to equal the number of DB-Servers and has a value of 0. Otherwise, the default value is controlled by the current database’s default writeConcern, which uses the --cluster.write-concern startup option as default, which defaults to 1. (cluster only)

                                  Responses
                                  • The collection has been created.

                                      Response Body application/json object
                                    • Whether the in-memory hash cache for documents is enabled for this collection.

                                    • A list of objects, each representing a computed value.

                                      • An array of strings that defines on which write operations the value is computed.

                                        Possible values: "insert", "update", "replace"

                                      • An AQL RETURN operation with an expression that computes the desired value.

                                      • Whether the write operation fails if the expression produces a warning.

                                      • Whether the target attribute is set if the expression evaluates to null.

                                      • The name of the target attribute.

                                      • Whether the computed value takes precedence over a user-provided or existing attribute.

                                    • The name of another collection. This collection uses the replicationFactor, numberOfShards and shardingStrategy properties of the other collection and the shards of this collection are distributed in the same way as the shards of the other collection.

                                    • A unique identifier of the collection. This is an internal property.

                                    • A unique identifier of the collection (deprecated).

                                    • Whether the SmartGraph or EnterpriseGraph this collection belongs to is disjoint (Enterprise Edition only). This is an internal property. (cluster only)

                                    • Whether the collection is used in a SmartGraph or EnterpriseGraph (Enterprise Edition only). This is an internal property. (cluster only)

                                    • Whether the collection is a system collection. Collection names that starts with an underscore are usually system collections.

                                    • An object which contains key generation options.

                                      • If set to true, then you are allowed to supply own key values in the _key attribute of a document. If set to false, then the key generator is solely responsible for generating keys and an error is raised if you supply own key values in the _key attribute of documents.

                                        You should not use both user-specified and automatically generated document keys in the same collection in cluster deployments for collections with more than a single shard. Mixing the two can lead to conflicts because Coordinators that auto-generate keys in this case are not aware of all keys which are already used.

                                      • The increment value for the autoincrement key generator. Not used by other key generator types.

                                      • The offset value for the autoincrement or padded key generator. This is an internal property for restoring dumps properly.

                                      • The initial offset value for the autoincrement key generator. Not used by other key generator types.

                                      • Specifies the type of the key generator. Possible values:

                                        • "traditional"
                                        • "autoincrement"
                                        • "uuid"
                                        • "padded"

                                    • The name of this collection.

                                    • The number of shards of the collection. (cluster only)

                                    • Contains how many copies of each shard are kept on different DB-Servers. It is an integer number in the range of 1-10 or the string "satellite" for SatelliteCollections (Enterprise Edition only). (cluster only)

                                    • An object that specifies the collection-level schema for documents.

                                    • Contains the names of document attributes that are used to determine the target shard for documents. (cluster only)

                                    • The sharding strategy selected for the collection. (cluster only)

                                      Possible values:

                                      • "community-compat"
                                      • "enterprise-compat"
                                      • "enterprise-smart-edge-compat"
                                      • "hash"
                                      • "enterprise-hash-smart-edge"
                                      • "enterprise-hex-smart-vertex"

                                    • The attribute that is used for sharding: vertices with the same value of this attribute are placed in the same shard. All vertices are required to have this attribute set and it has to be a string. Edges derive the attribute from their connected vertices (Enterprise Edition only). (cluster only)

                                    • Determines an attribute of the collection that must contain the shard key value of the referred-to SmartJoin collection (Enterprise Edition only). (cluster only)

                                    • Whether the newer revision-based replication protocol is enabled for this collection. This is an internal property.

                                    • The type of the collection:

                                      • 0: “unknown”
                                      • 2: regular document collection
                                      • 3: edge collection

                                    • If true, creating, changing, or removing documents waits until the data has been synchronized to disk.

                                    • Determines how many copies of each shard are required to be in-sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of writeConcern cannot be greater than replicationFactor.

                                      If distributeShardsLike is set, the default writeConcern is that of the prototype collection. For SatelliteCollections, the writeConcern is automatically controlled to equal the number of DB-Servers and has a value of 0. Otherwise, the default value is controlled by the current database’s default writeConcern, which uses the --cluster.write-concern startup option as default, which defaults to 1. (cluster only)

                                  • The name or another required attribute is missing or an attribute has an invalid value.

                                      Response Body application/json object
                                    • The HTTP response status code.

                                    • A flag indicating that an error occurred.

                                    • A descriptive error message.

                                    • ArangoDB error number for the error that occurred.

                                  Examples

                                  curl -X POST --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/collection' <<'EOF'
                                  {
                                    "name": "testCollectionBasics"
                                  }
                                  EOF
                                  
                                  curl -X POST --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/collection' <<'EOF'
                                  {
                                    "name": "testCollectionEdges",
                                    "type": 3
                                  }
                                  EOF
                                  Show output

                                  curl -X POST --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/collection' <<'EOF'
                                  {
                                    "name": "testCollectionUsers",
                                    "keyOptions": {
                                      "type": "autoincrement",
                                      "increment": 5,
                                      "allowUserKeys": true
                                    }
                                  }
                                  EOF
                                  Show output

                                  Drop a collection

                                  DELETE /_db/{database-name}/_api/collection/{collection-name}
                                  Delete the collection identified by collection-name and all its documents.
                                  Path Parameters
                                  • The name of the database.

                                  • The name of the collection to drop.

                                    Accessing collections by their numeric ID is deprecated from version 3.4.0 on. You should reference them via their names instead.

                                  Query Parameters
                                  • Whether or not the collection to drop is a system collection. This parameter must be set to true in order to drop a system collection.

                                  HTTP Headers
                                    Responses
                                    • Dropping the collection has been successful.

                                        Response Body application/json object
                                      • The HTTP response status code.

                                      • A flag indicating that no error occurred.

                                      • The identifier of the dropped collection.

                                    • The collection-name parameter is missing.

                                        Response Body application/json object
                                      • The HTTP response status code.

                                      • A flag indicating that an error occurred.

                                      • A descriptive error message.

                                      • ArangoDB error number for the error that occurred.

                                    • A collection called collection-name could not be found.

                                        Response Body application/json object
                                      • The HTTP response status code.

                                      • A flag indicating that an error occurred.

                                      • A descriptive error message.

                                      • ArangoDB error number for the error that occurred.

                                    Examples

                                    Using an identifier:

                                    curl -X DELETE --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/68748'
                                    Show output

                                    Using a name:

                                    curl -X DELETE --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/products1'
                                    Show output

                                    Dropping a system collection

                                    curl -X DELETE --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/_example?isSystem=true'
                                    Show output

                                    Truncate a collection

                                    PUT /_db/{database-name}/_api/collection/{collection-name}/truncate
                                    Removes all documents from the collection, but leaves the indexes intact.
                                    Path Parameters
                                    • The name of the database.

                                    • The name of the collection.

                                      Accessing collections by their numeric ID is deprecated from version 3.4.0 on. You should reference them via their names instead.

                                    Query Parameters
                                    • If set to true, the data is synchronized to disk before returning from the truncate operation.

                                    • If set to true, the storage engine is told to start a compaction in order to free up disk space. This can be resource intensive. If the only intention is to start over with an empty collection, specify false.

                                    HTTP Headers
                                    • To make this operation a part of a Stream Transaction, set this header to the transaction ID returned by the POST /_api/transaction/begin call.

                                    Responses
                                    • Truncating the collection was successful. Returns the basic information about the collection.

                                        Response Body application/json object
                                      • The HTTP response status code.

                                      • A flag indicating that no error occurred.

                                      • A unique identifier of the collection (deprecated).

                                    • The collection-name parameter is missing.

                                        Response Body application/json object
                                      • The HTTP response status code.

                                      • A flag indicating that an error occurred.

                                      • A descriptive error message.

                                      • ArangoDB error number for the error that occurred.

                                    • A collection called collection-name could not be found.

                                        Response Body application/json object
                                      • The HTTP response status code.

                                      • A flag indicating that an error occurred.

                                      • A descriptive error message.

                                      • ArangoDB error number for the error that occurred.

                                    Examples

                                    curl -X PUT --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/products/truncate'
                                    Show output

                                    Modify collections

                                    Load a collection

                                    PUT /_db/{database-name}/_api/collection/{collection-name}/load
                                    The load function is deprecated from version 3.8.0 onwards and is a no-op from version 3.9.0 onwards. It should no longer be used, as it may be removed in a future version of ArangoDB.

                                    Since ArangoDB version 3.9.0 this API does nothing. Previously, it used to load a collection into memory.

                                    Path Parameters
                                    • The name of the database.

                                    • The name of the collection.

                                      Accessing collections by their numeric ID is deprecated from version 3.4.0 on. You should reference them via their names instead.

                                    Query Parameters
                                      HTTP Headers
                                        Responses
                                        • Returns the basic collection properties for compatibility reasons.

                                            Response Body application/json object
                                          • The HTTP response status code.

                                          • The number of documents currently present in the collection.

                                          • A flag indicating that no error occurred.

                                          • A unique identifier of the collection. This is an internal property.

                                          • A unique identifier of the collection (deprecated).

                                          • Whether the collection is a system collection. Collection names that starts with an underscore are usually system collections.

                                          • The name of the collection.

                                          • The status of the collection.

                                            • 3: loaded
                                            • 5: deleted

                                            Every other status indicates a corrupted collection.

                                          • The type of the collection:

                                            • 0: “unknown”
                                            • 2: regular document collection
                                            • 3: edge collection

                                        • The collection-name parameter or the name attribute is missing.

                                            Response Body application/json object
                                          • The HTTP response status code.

                                          • A flag indicating that an error occurred.

                                          • A descriptive error message.

                                          • ArangoDB error number for the error that occurred.

                                        • A collection called collection-name could not be found.

                                            Response Body application/json object
                                          • The HTTP response status code.

                                          • A flag indicating that an error occurred.

                                          • A descriptive error message.

                                          • ArangoDB error number for the error that occurred.

                                        Examples

                                        curl -X PUT --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/products/load'
                                        Show output

                                        Unload a collection

                                        PUT /_db/{database-name}/_api/collection/{collection-name}/unload
                                        The unload function is deprecated from version 3.8.0 onwards and is a no-op from version 3.9.0 onwards. It should no longer be used, as it may be removed in a future version of ArangoDB.

                                        Since ArangoDB version 3.9.0 this API does nothing. Previously it used to unload a collection from memory, while preserving all documents.

                                        Path Parameters
                                        • The name of the database.

                                        • The name of the collection.

                                          Accessing collections by their numeric ID is deprecated from version 3.4.0 on. You should reference them via their names instead.

                                        Query Parameters
                                          HTTP Headers
                                            Responses
                                            • Returns the basic collection properties for compatibility reasons.

                                                Response Body application/json object
                                              • The HTTP response status code.

                                              • A flag indicating that no error occurred.

                                              • A unique identifier of the collection. This is an internal property.

                                              • A unique identifier of the collection (deprecated).

                                              • Whether the collection is a system collection. Collection names that starts with an underscore are usually system collections.

                                              • The name of the collection.

                                              • The status of the collection.

                                                • 3: loaded
                                                • 5: deleted

                                                Every other status indicates a corrupted collection.

                                              • The type of the collection:

                                                • 0: “unknown”
                                                • 2: regular document collection
                                                • 3: edge collection

                                            • The collection-name parameter or the name attribute is missing.

                                                Response Body application/json object
                                              • The HTTP response status code.

                                              • A flag indicating that an error occurred.

                                              • A descriptive error message.

                                              • ArangoDB error number for the error that occurred.

                                            • A collection called collection-name could not be found.

                                                Response Body application/json object
                                              • The HTTP response status code.

                                              • A flag indicating that an error occurred.

                                              • A descriptive error message.

                                              • ArangoDB error number for the error that occurred.

                                            Examples

                                            curl -X PUT --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/products/unload'
                                            Show output

                                            Load collection indexes into memory

                                            PUT /_db/{database-name}/_api/collection/{collection-name}/loadIndexesIntoMemory

                                            You can call this endpoint to try to cache this collection’s index entries in the main memory. Index lookups served from the memory cache can be much faster than lookups not stored in the cache, resulting in a performance boost.

                                            The endpoint iterates over suitable indexes of the collection and stores the indexed values (not the entire document data) in memory. This is implemented for edge indexes only.

                                            The endpoint returns as soon as the index warmup has been scheduled. The index warmup may still be ongoing in the background, even after the return value has already been sent. As all suitable indexes are scanned, it may cause significant I/O activity and background load.

                                            This feature honors memory limits. If the indexes you want to load are smaller than your memory limit, this feature guarantees that most index values are cached. If the index is greater than your memory limit, this feature fills up values up to this limit. You cannot control which indexes of the collection should have priority over others.

                                            It is guaranteed that the in-memory cache data is consistent with the stored index data at all times.

                                            Path Parameters
                                            • The name of the database.

                                            • The name of the collection.

                                              Accessing collections by their numeric ID is deprecated from version 3.4.0 on. You should reference them via their names instead.

                                            Query Parameters
                                              HTTP Headers
                                                Responses
                                                • The index loading has been scheduled for all suitable indexes.

                                                    Response Body application/json object
                                                  • A flag indicating that no error occurred.

                                                • The collection-name parameter is missing.

                                                    Response Body application/json object
                                                  • The HTTP response status code.

                                                  • A flag indicating that an error occurred.

                                                  • A descriptive error message.

                                                  • ArangoDB error number for the error that occurred.

                                                • A collection called collection-name could not be found.

                                                    Response Body application/json object
                                                  • The HTTP response status code.

                                                  • A flag indicating that an error occurred.

                                                  • A descriptive error message.

                                                  • ArangoDB error number for the error that occurred.

                                                Examples

                                                curl -X PUT --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/products/loadIndexesIntoMemory'
                                                Show output

                                                Change the properties of a collection

                                                PUT /_db/{database-name}/_api/collection/{collection-name}/properties
                                                Changes the properties of a collection. Only the provided attributes are updated. Collection properties cannot be changed once a collection is created except for the listed properties, as well as the collection name via the rename endpoint (but not in clusters).
                                                Path Parameters
                                                • The name of the database.

                                                • The name of the collection.

                                                  Accessing collections by their numeric ID is deprecated from version 3.4.0 on. You should reference them via their names instead.

                                                Query Parameters
                                                  HTTP Headers
                                                    Request Body application/json object
                                                    • Whether the in-memory hash cache for documents should be enabled for this collection. Can be controlled globally with the --cache.size startup option. The cache can speed up repeated reads of the same documents via their document keys. If the same documents are not fetched often or are modified frequently, then you may disable the cache to avoid the maintenance costs.

                                                    • An optional list of objects, each representing a computed value.

                                                      • An array of strings to define on which write operations the value shall be computed.

                                                        Possible values: "insert", "update", "replace"

                                                      • An AQL RETURN operation with an expression that computes the desired value. See Computed Value Expressions for details.

                                                      • Whether to let the write operation fail if the expression produces a warning.

                                                      • Whether the target attribute shall be set if the expression evaluates to null. You can set the option to false to not set (or unset) the target attribute if the expression returns null.

                                                      • The name of the target attribute. Can only be a top-level attribute, but you may return a nested object. Cannot be _key, _id, _rev, _from, _to, or a shard key attribute.

                                                      • Whether the computed value shall take precedence over a user-provided or existing attribute.

                                                    • In a cluster, this attribute determines how many copies of each shard are kept on different DB-Servers. The value 1 means that only one copy (no synchronous replication) is kept. A value of k means that k-1 replicas are kept. For SatelliteCollections, it needs to be the string "satellite", which matches the replication factor to the number of DB-Servers (Enterprise Edition only).

                                                      Any two copies reside on different DB-Servers. Replication between them is synchronous, that is, every write operation to the “leader” copy will be replicated to all “follower” replicas, before the write operation is reported successful.

                                                      If a server fails, this is detected automatically and one of the servers holding copies take over, usually without an error being reported.

                                                    • Optional object that specifies the collection level schema for documents. The attribute keys rule, level and message must follow the rules documented in Document Schema Validation

                                                    • If set to true, the data is synchronized to disk before returning from a document create, update, replace or removal operation.

                                                    • Determines how many copies of each shard are required to be in sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of writeConcern cannot be greater than replicationFactor.

                                                      If distributeShardsLike is set, the default writeConcern is that of the prototype collection. For SatelliteCollections, the writeConcern is automatically controlled to equal the number of DB-Servers and has a value of 0. Otherwise, the default value is controlled by the current database’s default writeConcern, which uses the --cluster.write-concern startup option as default, which defaults to 1. (cluster only)

                                                    Responses
                                                    • The collection has been updated successfully.

                                                        Response Body application/json object
                                                      • Whether the in-memory hash cache for documents is enabled for this collection.

                                                      • The HTTP response status code.

                                                      • A list of objects, each representing a computed value.

                                                        • An array of strings that defines on which write operations the value is computed.

                                                          Possible values: "insert", "update", "replace"

                                                        • An AQL RETURN operation with an expression that computes the desired value.

                                                        • Whether the write operation fails if the expression produces a warning.

                                                        • Whether the target attribute is set if the expression evaluates to null.

                                                        • The name of the target attribute.

                                                        • Whether the computed value takes precedence over a user-provided or existing attribute.

                                                      • The name of another collection. This collection uses the replicationFactor, numberOfShards and shardingStrategy properties of the other collection and the shards of this collection are distributed in the same way as the shards of the other collection.

                                                      • A flag indicating that no error occurred.

                                                      • A unique identifier of the collection. This is an internal property.

                                                      • A unique identifier of the collection (deprecated).

                                                      • Whether the SmartGraph or EnterpriseGraph this collection belongs to is disjoint (Enterprise Edition only). This is an internal property. (cluster only)

                                                      • Whether the collection is used in a SmartGraph or EnterpriseGraph (Enterprise Edition only). This is an internal property. (cluster only)

                                                      • Whether the collection is a system collection. Collection names that starts with an underscore are usually system collections.

                                                      • An object which contains key generation options.

                                                        • If set to true, then you are allowed to supply own key values in the _key attribute of a document. If set to false, then the key generator is solely responsible for generating keys and an error is raised if you supply own key values in the _key attribute of documents.

                                                          You should not use both user-specified and automatically generated document keys in the same collection in cluster deployments for collections with more than a single shard. Mixing the two can lead to conflicts because Coordinators that auto-generate keys in this case are not aware of all keys which are already used.

                                                        • The increment value for the autoincrement key generator. Not used by other key generator types.

                                                        • The offset value of the autoincrement or padded key generator. This is an internal property for restoring dumps properly.

                                                        • The initial offset value for the autoincrement key generator. Not used by other key generator types.

                                                        • Specifies the type of the key generator. Possible values:

                                                          • "traditional"
                                                          • "autoincrement"
                                                          • "uuid"
                                                          • "padded"

                                                      • The name of this collection.

                                                      • The number of shards of the collection. (cluster only)

                                                      • Contains how many copies of each shard are kept on different DB-Servers. It is an integer number in the range of 1-10 or the string "satellite" for SatelliteCollections (Enterprise Edition only). (cluster only)

                                                      • An object that specifies the collection-level schema for documents.

                                                      • Contains the names of document attributes that are used to determine the target shard for documents. (cluster only)

                                                      • The sharding strategy selected for the collection. (cluster only)

                                                        Possible values:

                                                        • "community-compat"
                                                        • "enterprise-compat"
                                                        • "enterprise-smart-edge-compat"
                                                        • "hash"
                                                        • "enterprise-hash-smart-edge"
                                                        • "enterprise-hex-smart-vertex"

                                                      • The attribute that is used for sharding: vertices with the same value of this attribute are placed in the same shard. All vertices are required to have this attribute set and it has to be a string. Edges derive the attribute from their connected vertices (Enterprise Edition only). (cluster only)

                                                      • Determines an attribute of the collection that must contain the shard key value of the referred-to SmartJoin collection (Enterprise Edition only). (cluster only)

                                                      • Whether the newer revision-based replication protocol is enabled for this collection. This is an internal property.

                                                      • The type of the collection:

                                                        • 0: “unknown”
                                                        • 2: regular document collection
                                                        • 3: edge collection

                                                      • If true, creating, changing, or removing documents waits until the data has been synchronized to disk.

                                                      • Determines how many copies of each shard are required to be in-sync on the different DB-Servers. If there are less than these many copies in the cluster, a shard refuses to write. Writes to shards with enough up-to-date copies succeed at the same time, however. The value of writeConcern cannot be greater than replicationFactor.

                                                        If distributeShardsLike is set, the default writeConcern is that of the prototype collection. For SatelliteCollections, the writeConcern is automatically controlled to equal the number of DB-Servers and has a value of 0. Otherwise, the default value is controlled by the current database’s default writeConcern, which uses the --cluster.write-concern startup option as default, which defaults to 1. (cluster only)

                                                    • The collection-name parameter is missing.

                                                        Response Body application/json object
                                                      • The HTTP response status code.

                                                      • A flag indicating that an error occurred.

                                                      • A descriptive error message.

                                                      • ArangoDB error number for the error that occurred.

                                                    • A collection called collection-name could not be found.

                                                        Response Body application/json object
                                                      • The HTTP response status code.

                                                      • A flag indicating that an error occurred.

                                                      • A descriptive error message.

                                                      • ArangoDB error number for the error that occurred.

                                                    Examples

                                                    curl -X PUT --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/collection/products/properties' <<'EOF'
                                                    {
                                                      "waitForSync": true
                                                    }
                                                    EOF
                                                    Show output

                                                    Rename a collection

                                                    PUT /_db/{database-name}/_api/collection/{collection-name}/rename

                                                    Renames a collection.

                                                    Renaming collections is not supported in cluster deployments.

                                                    If renaming the collection succeeds, then the collection is also renamed in all graph definitions inside the _graphs collection in the current database.

                                                    Path Parameters
                                                    • The name of the database.

                                                    • The name of the collection to rename.

                                                      Accessing collections by their numeric ID is deprecated from version 3.4.0 on. You should reference them via their names instead.

                                                    Query Parameters
                                                      HTTP Headers
                                                        Request Body application/json object
                                                        • The new collection name.

                                                        Responses
                                                        • The collection has been renamed successfully.

                                                            Response Body application/json object
                                                          • The HTTP response status code.

                                                          • A flag indicating that no error occurred.

                                                          • A unique identifier of the collection. This is an internal property.

                                                          • A unique identifier of the collection (deprecated).

                                                          • Whether the collection is a system collection. Collection names that starts with an underscore are usually system collections.

                                                          • The name of the collection.

                                                          • The status of the collection.

                                                            • 3: loaded
                                                            • 5: deleted

                                                            Every other status indicates a corrupted collection.

                                                          • The type of the collection:

                                                            • 0: “unknown”
                                                            • 2: regular document collection
                                                            • 3: edge collection

                                                        • The collection-name parameter or the name attribute is missing.

                                                            Response Body application/json object
                                                          • The HTTP response status code.

                                                          • A flag indicating that an error occurred.

                                                          • A descriptive error message.

                                                          • ArangoDB error number for the error that occurred.

                                                        • A collection called collection-name could not be found.

                                                            Response Body application/json object
                                                          • The HTTP response status code.

                                                          • A flag indicating that an error occurred.

                                                          • A descriptive error message.

                                                          • ArangoDB error number for the error that occurred.

                                                        Examples

                                                        curl -X PUT --header 'accept: application/json' --data-binary @- --dump - 'http://localhost:8529/_api/collection/products1/rename' <<'EOF'
                                                        {
                                                          "name": "newname"
                                                        }
                                                        EOF
                                                        Show output

                                                        Recalculate the document count of a collection

                                                        PUT /_db/{database-name}/_api/collection/{collection-name}/recalculateCount
                                                        Recalculates the document count of a collection, if it ever becomes inconsistent.
                                                        Path Parameters
                                                        • The name of the database.

                                                        • The name of the collection.

                                                        Query Parameters
                                                          HTTP Headers
                                                            Responses
                                                            • The document count has been recalculated successfully.

                                                                Response Body application/json object
                                                              • The HTTP response status code.

                                                              • The recalculated document count. This attribute is not present when using a cluster.

                                                              • A flag indicating that no error occurred.

                                                            • The collection-name parameter is missing.

                                                                Response Body application/json object
                                                              • The HTTP response status code.

                                                              • A flag indicating that an error occurred.

                                                              • A descriptive error message.

                                                              • ArangoDB error number for the error that occurred.

                                                            • A collection called collection-name could not be found.

                                                                Response Body application/json object
                                                              • The HTTP response status code.

                                                              • A flag indicating that an error occurred.

                                                              • A descriptive error message.

                                                              • ArangoDB error number for the error that occurred.

                                                            Compact a collection

                                                            PUT /_db/{database-name}/_api/collection/{collection-name}/compact

                                                            Compacts the data of a collection in order to reclaim disk space. The operation will compact the document and index data by rewriting the underlying .sst files and only keeping the relevant entries.

                                                            Under normal circumstances, running a compact operation is not necessary, as the collection data will eventually get compacted anyway. However, in some situations, e.g. after running lots of update/replace or remove operations, the disk data for a collection may contain a lot of outdated data for which the space shall be reclaimed. In this case the compaction operation can be used.

                                                            Path Parameters
                                                            • The name of the database.

                                                            • Name of the collection to compact

                                                            Query Parameters
                                                              HTTP Headers
                                                                Responses
                                                                • The compaction has been started successfully.

                                                                    Response Body application/json object
                                                                  • The HTTP response status code.

                                                                  • A flag indicating that no error occurred.

                                                                  • A unique identifier of the collection. This is an internal property.

                                                                  • A unique identifier of the collection (deprecated).

                                                                  • Whether the collection is a system collection. Collection names that starts with an underscore are usually system collections.

                                                                  • The name of the collection.

                                                                  • The status of the collection.

                                                                    • 3: loaded
                                                                    • 5: deleted

                                                                    Every other status indicates a corrupted collection.

                                                                  • The type of the collection:

                                                                    • 0: “unknown”
                                                                    • 2: regular document collection
                                                                    • 3: edge collection

                                                                • If the request was not authenticated as a user with sufficient rights.

                                                                    Response Body application/json object
                                                                  • The HTTP response status code.

                                                                  • A flag indicating that an error occurred.

                                                                  • A descriptive error message.

                                                                  • ArangoDB error number for the error that occurred.

                                                                Examples

                                                                curl -X PUT --header 'accept: application/json' --dump - 'http://localhost:8529/_api/collection/testCollection/compact'
                                                                Show output