{
"name": "John",
"mark": 70,
"id": 1,
"course": "Mathematics"
},
{
"name": "John",
"mark": 90,
This file contains 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
// Require the current branch [next] of rethinkdbdash (probably 1.16.5) | |
var r = require('rethinkdbdash')(); | |
// Set up the infinite domino effect | |
r.table('test').changes()('new_val').without('id').toStream() | |
.on('error', handleError) | |
.pipe(r.table('test').toWritableStream()) | |
.on('error', handleError); | |
// Start the domino effect |
This file contains 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 r = require('rethinkdbdash')(); | |
var bluebird = require('bluebird'); | |
var assert = require('assert'); | |
bluebird.coroutine(function*() { | |
try { | |
var result = yield r.table('users').get("[email protected]").update(function(user) { | |
return { age: user("age").add(1) } | |
}); | |
assert.equal(result.replaced, 1); |
This file contains 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
// Suppose that there are 10 digits somewhere in the string | |
// Extract the 10 digits, and concatenate them | |
r.add(r.args( | |
r.expr('(123) 456-7890').match('^[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*([\\d]{1})[^\\d]*$')("groups")("str") | |
)) |
Here's a proposal:
join
takes 2 arguments:
left_key
that can be a string or a function (it's the same thing as what eqJoin require for the first argumentother_table
: the second sequence is a table.
The command has the following options:
index - <string>
: The name of the index used onother_table
to perform the join, default to the primary key.group - <string>
: If this option is undefined, the join command would operate as it does now. If it's set to a string, it would group the right values into an array and inject in the field (or just inject the document isunique
is set totrue
(the value forgroup
). The default isundefined
.outer_join -
whether the join should behave like an outer join or not. By defaulttrue
. The value is always false whengroup
isfalse
.
This file contains 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 r = require('rethinkdbdash')(); | |
setInterval(function() { | |
r.table("logs").insert({ | |
date: r.now() | |
}).run({noreply: true}) | |
, 1000) | |
r.table("logs").changes().run().then(function(feed) { |
This file contains 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 config = require(__dirname+'/config.js'); | |
var thinky = require(__dirname+'/lib/thinky.js')(config); | |
var r = thinky.r; | |
var Errors = thinky.Errors; | |
var util = require(__dirname+'/test/util.js'); | |
var assert = require('assert'); | |
thinky.r.dbCreate("foo").run().then(function(result) { |
This file contains 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 pytz import timezone | |
import pickle | |
timezone = timezone('US/Pacific') | |
print timezone | |
f = open('test.txt', 'w') | |
pickle.dump(timezone, f) | |
f.close() |
This file contains 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
r.db('test').table('foo').update(function(doc) { | |
return doc.merge({foo: {channel: doc("id").add(doc("name")) }}) | |
}) |
This file contains 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
r.table('story').indexCreate('storyAndId', [r.row("storyAuthor"), r.row("id")] ) | |
var authorId = '1'; | |
r.table('comment').orderBy({index: r.desc('created')}) | |
.eqJoin(function(comment) { | |
return [authorId, comment("parentId")] | |
}, r.table('story'), {index: "storyAndId"}) | |
.limit(20) |
NewerOlder