Azure Database for PostgreSQL
Azure Database for MySQL
Azure Database for MariaDB
Β
Relational DB
Document DB
{
"id": "9f4657a4-43e3-4a47-9392-6c418035d552",
"key": "7a9f3c4b-3adc-4fb1-a539-47734db30ae0",
"user": {
"Id": 215,
"FirstName": "Wayne",
"LastName": "Hayes",
"FullName": "Wayne Hayes",
"UserName": "Wayne19",
"UserNameLower": "wayne19",
"Email": "Wayne.Hayes@hotmail.com",
"CartId": "a78e749e-ebb2-434c-b658-6795ada0e086",
"Gender": 0,
"Orders": [
{
"OrderId": 217,
"Item": "banana",
"Quantity": 1
}
],
"Address": {
"Type": "company",
"Address": {
"City": "Florineport",
"ZipCode": "38056-0892",
"Street": "Miller Center",
"CountryCode": "QA"
}
}
},
"_rid": "vE5vAKy0d4mWzgMAAAAAAA==",
"_self": "dbs/vE5vAA==/colls/vE5vAKy0d4k=/docs/vE5vAKy0d4mWzgMAAAAAAA==/",
"_etag": "\"0e0000c6-0000-0d00-0000-6005f1f10000\"",
"_attachments": "attachments/",
"_ts": 1611002353
}
- Creating is easy :)
- 5-15 minutes :(
- I will cheat a bit
az cosmosdb create \
--name $COSMOS_DB_NAME \
--resource-group $group \
--kind MongoDB
Let's look on it π
--simple select
SELECT *
FROM c
WHERE c.user.LastName = 'Bernhard'
--simple count
SELECT count(1)
FROM c
WHERE c.user.LastName = 'Bernhard'
SELECT c.id, c.user.Id,
c.user.FirstName, c.user.LastName,
o.Item, o.Quantity
FROM c
JOIN o IN c.user.Orders
WHERE 1=1
AND c.user.LastName = 'Bernhard'
AND o.Item='kiwi'
and o.Quantity=1
πππ
SELECT count(1)
FROM c
JOIN o IN c.user.Orders
WHERE 1=1
AND o.Item>'kiwi'
and o.Quantity=1
PACELC theoremΒ is an extension to the CAP theorem. It states that in case of network partitioning (P) in a distributed computer system, one has to choose between availability (A) and consistency (C) (as per the CAP theorem), but else (E), even when the system is running normally in the absence of partitions, one has to choose between latency (L) and consistency (C).
(sorry)
{
"indexingMode": "consistent",
"automatic": true,
"includedPaths": [
{
"path": "/*"
}
],
"excludedPaths": [
{
"path": "/user/Address/*"
},
{
"path": "/\"_etag\"/?"
}
],
"compositeIndexes": [
[
{
"path": "/user/LastName",
"order": "ascending"
},
{
"path": "/user/FirstName",
"order": "descending"
}
]
]
}
SELECT count(1)
FROM c
JOIN o IN c.user.Orders
where 1=1
AND c.user.LastName > 'Z'
AND c.user.FirstName < 'L'
AND CONTAINS(c.user.Email, 'gmail', true)
-- run on data & db2
SELECT count(1)
FROM c
where c.user.Address.Address.CountryCode="CZ"
--only on db2
SELECT * FROM c
ORDER BY c.user.LastName desc,
c.user.FirstName asc
With free tier, you'll get the first 400 RU/s and 5 GB of storage in this account for free. To keep your account free, keep the total RU/s across all resources in the account to 400 RU/s.
var query = _dbClient.Where<UserDocument>( _collectionUri,
d =>d.User.UserName.ToLower() == criteria.SearchString);
SELECT * FROM c
WHERE LOWER(c.user.UserName) = "{search}"
------------------------------
var query = _dbClient.Where<UserDocument>( _collectionUri,
d => d.User.UserName.Equals(originalSearchString,
StringComparison.OrdinalIgnoreCase));
SELECT * FROM c
WHERE STRINGEQUALS(c.user.UserName, "{search}", true)
----
var query = _dbClient.Where<UserDocument>( _collectionUri,
d => d.User.UserNameLower == originalSearchString);
SELECT * FROM c
WHERE c.user.UserNameLower = "{search}"
Twitter: @ptrstpp950