Slamdata - Mongodb Cheat Sheet

ADVERTISEMENT

The SQL Standard for MongoDB
100% Open Source - 100% In-Database
SlamData is a 100% open source solution for native analytics and reporting on MongoDB.
Type
Literal Examples
Description
OID ‘507f1f77bcf86cd799439011’
Object ID
Object IDs, which uniquely identify values in
Easily create interactive reporting dashboards that can be viewed and embedded in web sites, web
sets.
apps, and mobile apps.
(1, 2, 3)
Ordered Set*
Ordered set literals.
Explore and re ne data using a high-level GUI
Execute any query using SlamSQL, a subset of ANSI SQL
[1, 2, 3]
Array
Arrays of values.
Pushes 100% of queries into MongoDB (no relocation or streaming)
Emulates data types, operators, and functions not supported by MongoDB
{“foo”: 123}
Object
Maps of values.
Both API and GUI interfaces for programmatic and interactive use cases
Natively supports nesting, arrays, and heterogeneous data (no ETL)
*Denotes a type not natively supported by MongoDB and emulated by SlamData.
Basic Selection
Notebooks
Simple selection of all values from a path
Notebooks allow the creation of complex, optionally interactive data pipelines (including visualization).
SELECT
*
FROM
“/col”
Notebooks are built from individual cells, each of which has a well-de ned purpose. Notebooks can be edited, or
they can be published, which results in a URL that presents a nal interactive report, which hides all the details of
Selection of elds from a path:
the data pipeline.
SELECT
name, age
FROM
"/users"
Cells
Giving a path an alias to refer to in the query
SELECT
c.name, c.age
FROM
"/users" c
SlamData supports a variety of cell types, including the following:
Filtering a Result Set
Markdown - Create interactive forms and annotations
SELECT
c.name, c.age
FROM
"/users" c
Explore - Graphically explore any data set
Query - Write and execute SlamSQL
Filtering the result set by a boolean predicate
SELECT
c.name
FROM
"/users" c
Visualize - Create charts that render data from a query
WHERE
c.age > 40
Search - Perform semi-structured search on any data set
Filtering the result set by a string literal
These cell types let you build rich data pipleines that can be published to URLs, which can be shared with
SELECT
*
FROM
"/users" c
colleagues or embedded in web sites, web apps, and mobile apps.
WHERE
c.name = ‘Sherlock Holmes’
Filtering by multiple boolean predicates
SlamSQL Reference
SELECT
*
FROM
"/users" c
WHERE
c.name
= ‘Sherlock Holmes’
AND
SlamSQL is a subset of ANSI SQL, which support for every major SQL SELECT clause (AS, WHERE, JOIN,
c.street = ‘Baker Street’
GROUP BY, HAVING, LIMIT, OFFSET, CROSS, etc.), and many SQL functions and operators. It follows
Other relational and boolean operators
Postgres where SQL dialects diverge.
Relational - =, >=, <=, <>, BETWEEN, IN, NOT IN
Boolean - AND, OR, NOT
SlamSQL Data Types
Numbers
Type
Literal Examples
Description
All standard math operators are supported
null
Null
A sentinel value indicating missing information.
SELECT
c.age + 2 * 1 / 4 % 2
FROM
"/users" c
Strings
true, false
Boolean
Boolean values.
Concatenating string values together
SELECT
c.firstName || ‘ ‘ || c.lastName
AS
name
1, -2
Integer
Integers (no fractional component).
FROM
"/users" c
1., -2.19743
Decimal
Decimal numbers (optional fractional
Filtering a set by fuzzy string comparison
components)
SELECT
*
FROM
"/users" c
WHERE c.LIKE
= ‘%Joan%’
String
Raw text.
‘221B Baker Street’
Filtering a set by regular expression
TIMESTAMP ‘2004-10-19 10:23:54’
DateTime
Date / time values (ISO8601)
SELECT
*
FROM
"/users" c
WHERE c.LIKE
~ ‘[sS]h+’
TIME `10:23:54’
Time*
Time values.
Other string functions
LOWER - Convert to lowercase
DATE ‘2004-10-19’
Date*
Date values.
UPPER - Convert to uppercase
SUBSTRING - Extract a substring
INTERVAL ‘P1Y2M3DT4H5M6S’
Interval*
Repeating intervals (ISO8601).
LENGTH - Compute length of string

ADVERTISEMENT

00 votes

Related Articles

Related forms

Related Categories

Parent category: Education
Go
Page of 2