O'Reilly logo

Learning Azure DocumentDB by Riccardo Becker

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Using the FROM clause

The FROM clause is an optional clause, unless you want to apply filtering (by using the WHERE clause). The WHERE clause is used to specify the source(s) upon which the query needs to be executed. Mostly, the WHERE clause is used to select a collection. The FROM clause is needed when you want to query a collection.

Another example of using the SELECT statement without the FROM clause is the following code snippet:

SELECT CONTAINS(UPPER("Riccardo"), UPPER("ri"))

This SELECT statement only operates on string values and uses some of the built-in functions that DocumentDB provides (CONTAINS and UPPER). The output of this SELECT statement is as follows:

[
  {
    "$1": true
  }
]

Potentially, you could use DocumentDB only for its built-in functions, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required