@@ -632,24 +632,56 @@ RETURN MERGE_RECURSIVE(
632632)
633633```
634634
635- ## PARSE_IDENTIFIER ()
635+ ## PARSE_COLLECTION ()
636636
637- ` PARSE_IDENTIFIER (documentIdentifier) → parts `
637+ ` PARSE_COLLECTION (documentIdentifier) → collectionName `
638638
639639Parse a [ document ID] ( ../../concepts/data-structure/documents/_index.md#document-identifiers ) and
640- return its individual parts as separate attributes.
640+ return the collection name.
641+
642+ - ** documentIdentifier** (string\| object): a document identifier string (e.g. ` _users/1234 ` )
643+ or a regular document from a collection. Passing either a non-string or a non-document
644+ or a document without an ` _id ` attribute results in an error.
645+ - returns ** collectionName** (string): the name of the collection
646+
647+ ** Examples**
648+
649+ Parse a document identifier string and extract the collection name:
650+
651+ ``` aql
652+ ---
653+ name: aqlParseCollection_1
654+ description: ''
655+ ---
656+ RETURN PARSE_COLLECTION("_users/my-user")
657+ ```
658+
659+ Parse the ` _id ` attribute of a document to extract the collection name:
660+
661+ ``` aql
662+ ---
663+ name: aqlParseCollection_2
664+ description: ''
665+ ---
666+ RETURN PARSE_COLLECTION( { "_id": "mycollection/mykey", "value": "some value" } )
667+ ```
668+
669+ ## PARSE_IDENTIFIER()
670+
671+ ` PARSE_IDENTIFIER(documentIdentifier) → parts `
641672
642- This function can be used to easily determine the
643- [ collection name ] ( ../../concepts/data-structure/collections.md#collection-names ) and key of a given document.
673+ Parse a [ document ID ] ( ../../concepts/data-structure/documents/_index.md#document-identifiers )
674+ and separately return the collection name and the document key .
644675
645676- ** documentIdentifier** (string\| object): a document identifier string (e.g. ` _users/1234 ` )
646677 or a regular document from a collection. Passing either a non-string or a non-document
647- or a document without an ` _id ` attribute will result in an error.
648- - returns ** parts** (object): an object with the attributes * collection* and * key*
678+ or a document without an ` _id ` attribute results in an error.
679+ - returns ** parts** (object): an object with the attributes ` collection ` and ` key `
649680
650681** Examples**
651682
652- Parse a document identifier string:
683+ Parse a document identifier string and extract both the collection name and the
684+ document key:
653685
654686``` aql
655687---
@@ -659,7 +691,8 @@ description: ''
659691RETURN PARSE_IDENTIFIER("_users/my-user")
660692```
661693
662- Parse the document identifier string of a document (` _id ` attribute):
694+ Parse the ` _id ` attribute of a document to extract both the collection name and
695+ the document key:
663696
664697``` aql
665698---
@@ -669,6 +702,40 @@ description: ''
669702RETURN PARSE_IDENTIFIER( { "_id": "mycollection/mykey", "value": "some value" } )
670703```
671704
705+ ## PARSE_KEY()
706+
707+ ` PARSE_KEY(documentIdentifier) → key `
708+
709+ Parse a [ document ID] ( ../../concepts/data-structure/documents/_index.md#document-identifiers ) and
710+ return the document key.
711+
712+ - ** documentIdentifier** (string\| object): a document identifier string (e.g. ` _users/1234 ` )
713+ or a regular document from a collection. Passing either a non-string or a non-document
714+ or a document without an ` _id ` attribute results in an error.
715+ - returns ** key** (string): the document key
716+
717+ ** Examples**
718+
719+ Parse a document identifier string and extract the document key:
720+
721+ ``` aql
722+ ---
723+ name: aqlParseKey_1
724+ description: ''
725+ ---
726+ RETURN PARSE_KEY("_users/my-user")
727+ ```
728+
729+ Parse the ` _id ` attribute of a document to extract the document key:
730+
731+ ``` aql
732+ ---
733+ name: aqlParseKey_2
734+ description: ''
735+ ---
736+ RETURN PARSE_KEY( { "_id": "mycollection/mykey", "value": "some value" } )
737+ ```
738+
672739## TRANSLATE()
673740
674741` TRANSLATE(value, lookupDocument, defaultValue) → mappedValue `
0 commit comments