DocumentId (NoSQL query)

APPLIES TO: NoSQL

Extracts the integer identifier corresponding to a specific item within a physical partition.

Syntax

DOCUMENTID(<root_specifier>)

Arguments

Description
root_specifier Alias that identifies the root.

Return types

Integer identifying an item within a physical partition.

Examples

This example illustrates using this function to extract and return the integer identifier relative to a physical partition.

[
  {
    "id": "63700",
    "name": "Joltage Kid's Vest"
  }
]
SELECT
    p.id,
    p._rid,
    DOCUMENTID(p) AS documentId
FROM  
    product p
[
  {
    "id": "63700",
    "_rid": "36ZyAPW+uN8NAAAAAAAAAA==",
    "documentId": 13
  }
]

This function can also be used as a filter.

SELECT
    p.id,
    DOCUMENTID(p) AS documentId
FROM  
    product p
WHERE
    DOCUMENTID(p) >= 5 AND
    DOCUMENTID(p) <= 15
[
  {
    "id": "63700",
    "documentId": 13
  }
]

Remarks

  • This function returns an integer value that is only unique within a single physical partition.

See also