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": "5741047452",
    "name": "Joltage Kid's Vest"
  }
]
SELECT
    p.id,
    p._rid,
    DOCUMENTID(p) AS documentId
FROM  
    product p
[
  {
    "id": "5741047452",
    "_rid": "36ZyAPW+uN8NAAAAAAAAAA==",
    "documentId": 13
  }
]

This function can also be used as a filter.

[
  {
    "id": "5720559175",
    "name": "Joltage Kid's Vest"
  }
]
SELECT
    p.id,
    DOCUMENTID(p) AS documentId
FROM  
    product p
WHERE
    DOCUMENTID(p) >= 5 AND
    DOCUMENTID(p) <= 15
[
  {
    "id": "5720559175",
    "documentId": 13
  }
]

Remarks

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

See also