This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| { | |
| "public_identifier": "johnzablocki", | |
| "profile_pic_url": "https://s3.us-west-000.backblazeb2.com/proxycurl/person/johnzablocki/profile?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=0004d7f56a0400b0000000001%2F20241103%2Fus-west-000%2Fs3%2Faws4_request&X-Amz-Date=20241103T224739Z&X-Amz-Expires=3600&X-Amz-SignedHeaders=host&X-Amz-Signature=d1566262c2afb2daaeac77dc1c5cf31c536136b36a215536ecb414e51632d82e", | |
| "background_cover_image_url": null, | |
| "first_name": "John", | |
| "last_name": "Zablocki", | |
| "full_name": "John Zablocki", | |
| "follower_count": 1501, | |
| "occupation": "Vice President of Technology at Embark Veterinary", | |
| "headline": "VP of Technology at Embark Veterinary", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| //simple group | |
| db.workitems.aggregate( | |
| { | |
| $group: { _id: "$Owner", "Count": { $sum : 1 } } } | |
| ); | |
| //group with composite key | |
| db.workitems.aggregate( | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [ | |
| { | |
| Description: "Communications system", | |
| Owner: "John", | |
| Effort: 13, | |
| Tasks: [ | |
| { | |
| Description: "Develop templating engine", | |
| TimeRemaining: 21, | |
| Assignee: "Stefano", |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var newBeer = new Beer { Name = "Atlantic Amber" }; | |
| client.StoreJson(StoreMode.Add, "beer_Atlantic_Amber", newBeer); | |
| var view = client.GetView<Beer>("beers", "by_name") | |
| foreach(var beer in view.Key("Atlantic Amber").Limit(1)) | |
| { | |
| Console.WriteLine(beer.Name); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var beer = new Beer { Name = "Atlantic Amber" }; | |
| client.StoreJson(StoreMode.Add, "beer_Atlantic_Amber", beer); | |
| var view = client.GetView<Beer>("beers", "by_name"); | |
| foreach(var beer in view) | |
| { | |
| Console.WriteLine(beer.Name); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| client.Store(StoreMode.Add, "beer_Atlantic_Amber", "{ Name = \"Atlantic Amber\" }"); | |
| var view = client.GetView("beers", "by_name"); | |
| foreach(var row in view) | |
| { | |
| Console.WriteLine(row.ItemId); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| from couchbase.rest_client import RestConnection | |
| doc = """ | |
| { | |
| "_id": "_design/breweries", | |
| "views": { | |
| "all_breweries": { | |
| "map": "function(doc) { if (doc.type == 'beer') emit(null, doc) }" | |
| } | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import couchbase | |
| cb = couchbase.Server("192.168.1.131:8091", "", "") | |
| bucket = cb.bucket("default") | |
| rows = bucket.view("_design/breweries/_view/all_breweries") | |
| for row in rows: | |
| print row |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import couchbase | |
| cb = couchbase.Server("127.0.0.11:8091", "", "") | |
| bucket = cb.bucket("default") | |
| bucket.set("foo", 0, 0, "bar") | |
| print bucket.get("foo") |