-
Notifications
You must be signed in to change notification settings - Fork 1
/
rethink.js
41 lines (37 loc) · 1.5 KB
/
rethink.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
r = require('rethinkdb');
var connection = null;
r.connect({host: 'localhost', port: 28015}, function(err, conn) {
if (err) throw err;
connection = conn;
// console.log("conn:", connection);
r.table('projects').run(connection, function(err, cursor) {
if (err) throw err;
cursor.toArray(function(err, result) {
if (err) throw err;
console.log(JSON.stringify(result, null, 2));
});
});
// r.table('projects').insert([
// { name: "William Adama", tv_show: "Battlestar Galactica",
// posts: [
// {title: "Decommissioning speech", content: "The Cylon War is long over..."},
// {title: "We are at war", content: "Moments ago, this ship received word..."},
// {title: "The new Earth", content: "The discoveries of the past few days..."}
// ]
// },
// { name: "Laura Roslin", tv_show: "Battlestar Galactica",
// posts: [
// {title: "The oath of office", content: "I, Laura Roslin, ..."},
// {title: "They look like us", content: "The Cylons have the ability..."}
// ]
// },
// { name: "Jean-Luc Picard", tv_show: "Star Trek TNG",
// posts: [
// {title: "Civil rights", content: "There are some words I've known since..."}
// ]
// }
// ]).run(connection, function(err, result) {
// if (err) throw err;
// console.log(JSON.stringify(result, null, 2));
// })
})