-
StackOverflow 文件
-
rethinkdb 教程
-
開始使用 Node
-
將文件插入表中
r.connect({host: 'localhost', port: 28015})
.then((conn) => {
return r.db("stackoverflow").table("examples")
.insert({
// If `id` is not set, will automatically generate a UUID
id: 1,
name: 'Thinker',
// Will translate Date types.
creationDate: new Date(),
// Embedded array
tags: ['rethinkdb', 'rethinkdb-javascript', 'rethinkdb-python'],
// Will evaluate `r.now()` using server time
dateWithServerTime: r.now(),
// Embedded document
location: {
// Using geospatial example
coordinates: r.point(-122.423246,37.779388),
name: 'San Francisco'
},
}).run(conn);
}).then((result) => {
// Returns results object which includes array of generated UUIDs
// for inserted documents
console.log(result);
});