Skip to content

Instantly share code, notes, and snippets.

View mgroves's full-sized avatar

Matthew D. Groves mgroves

View GitHub Profile
@mgroves
mgroves / demo-notebook.n1qlnb
Last active July 12, 2023 19:27
Putting the SQL back in NoSQL
{"cells":[{"kind":1,"language":"markdown","value":"## Putting the SQL back into NoSQL\r\n\r\nThis notebook contains interesting and (hopefully) useful samples of SQL++ queries for Couchbase.\r\n\r\nThe goal of this demo is to demonstrate the power and flexibility of using SQL for JSON data."},{"kind":1,"language":"markdown","value":"### 1. Using `LIKE` to filter by text\r\n\r\nThe `LIKE` keyword supports `%` as wildcards.\r\n\r\nFor anything more complex, try the [Full Text Search](https://www.couchbase.com/products/full-text-search/) service instead."},{"kind":2,"language":"SQL++","value":"SELECT l.*\r\nFROM `travel-sample`.inventory.landmark l\r\nWHERE l.content LIKE '%breakfast%'\r\nLIMIT 10;"},{"kind":1,"language":"markdown","value":"### 2. `ANY ... IN ... SATISFIES` for arrays\r\n\r\nJSON data can contain arrays. To match data in an array, you can use the `ANY...IN...SATISFIES` syntax.\r\n\r\nThis query will match any route that has a flight AF547 in the schedule."},{"kind":2,"language":"SQL++","value":"

Keybase proof

I hereby claim:

  • I am mgroves on github.
  • I am mgroves (https://keybase.io/mgroves) on keybase.
  • I have a public key ASBZHdeJYExsJs05NWRGRcEV53u582xlvfKY_xlsz-JmEwo

To claim this, I am signing this object:

using System;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using LinqToTwitter;
namespace TweetImage
{
class Program
{
{
"transcript": {
"status": "completed",
"model_id": null,
"audio_src_url": "https://crosscuttingconcerns.blob.core.windows.net/podcasts/094JeremyMillerLamar.mp3",
"text": "This podcast is sponsored by smart sheet. The cloudbased work management platform and best kept secret of more than half the fortune five hundred companies, learn more at smart set. Com plus cross cutting concerns how to have a two every day at about what passing you [...] lie down how [...] stores transport reported to setup at a conference and it is cool. We recorded two do like to best explain use as have [...] street with process theology in loose it macros [...] are listening to the cross cutting concerns process on your host metro. Please visit the site cross cutting concerns. Com or you can subscribe now. Herecontact me read show notes and leave a comment to contact. I'm recording this post on july sixteen two thousand eighteen my guest today is the creator of numerous open source projects includi
using System;
using System.Collections.Generic;
using System.Xml;
using Couchbase;
using Couchbase.Configuration.Client;
using Newtonsoft.Json;
using Formatting = Newtonsoft.Json.Formatting;
namespace LoadingXml
{
{
"iisSettings": {
"windowsAuthentication": false,
"anonymousAuthentication": true,
"iisExpress": {
"applicationUrl": "http://localhost:48920/",
"sslPort": 0
}
},
"profiles": {
{
"AbstractTitle": "something something",
"AbstractBody": "<p>asdf asdf asdf asdf asd fasdf asd blarg</p>",
"History": [{
"EventName": "FooFest '98",
"EventDate": "1998-01-05T00:00:00",
"EventMainUrl": "http://foofest.com",
"EventSpeakingUrl": "http://foofest.com/something",
"VideoUrl": "http://youtube.com/something"
}],
@mgroves
mgroves / EnhancedDurability.cs
Created June 22, 2016 15:34
EnhancedDurability
config.BucketConfigs = new Dictionary<string, BucketConfiguration> {
{
"travel-sample", new BucketConfiguration
{
UseEnhancedDurability = true
}
}
};
@mgroves
mgroves / AtPlusExample.cs
Created June 22, 2016 15:33
AtPlusExample
private static void AtPlusExample()
{
Console.WriteLine("========= AtPlus");
// get the current count
var result1 = _bucket.Query<dynamic>("SELECT COUNT(1) as airportCount FROM `travel-sample` WHERE type='airport'")
.Rows.First();
Console.WriteLine($"Initial count: {result1.airportCount}");
// insert a new airport
@mgroves
mgroves / RequestPlusExample.cs
Created June 22, 2016 15:32
RequestPlusExample
private static void RequestPlusExample()
{
Console.WriteLine("========= RequestPlus");
// get the current count
var result1 =
_bucket.Query<dynamic>("SELECT COUNT(1) as airportCount FROM `travel-sample` WHERE type='airport'")
.Rows.First();
Console.WriteLine($"Initial count: {result1.airportCount}");