1
0
Fork 0

make example copyable

This commit is contained in:
Jan Steemann 2016-01-21 09:55:02 +01:00
parent 58410da019
commit f5f15a86d2
1 changed files with 12 additions and 12 deletions

View File

@ -40,12 +40,12 @@ db._executeTransaction({
read: "users" read: "users"
}, },
action: function () { action: function () {
// execute an AQL query that traverses a graph starting at a "users" vertex. /* execute an AQL query that traverses a graph starting at a "users" vertex.
// it is yet unknown into which other collections the query will traverse it is yet unknown into which other collections the query will traverse */
db._createStatement({ db._createStatement({
query: "FOR t IN TRAVERSAL(users, connections, "users/1234", "any", { }) RETURN t" query: "FOR t IN TRAVERSAL(users, connections, "users/1234", "any", { }) RETURN t"
}).execute().toArray().forEach(function (d) { }).execute().toArray().forEach(function (d) {
// ... /* ... */
}); });
} }
}); });
@ -66,12 +66,12 @@ db._executeTransaction({
allowImplicit: false allowImplicit: false
}, },
action: function () { action: function () {
// the below query will now fail because the collection connections has not /* the below query will now fail because the collection connections has not
// been specified in the list of collections used by the transaction been specified in the list of collections used by the transaction */
db._createStatement({ db._createStatement({
query: "FOR t IN TRAVERSAL(users, connections, "users/1234", "any", { }) RETURN t" query: "FOR t IN TRAVERSAL(users, connections, "users/1234", "any", { }) RETURN t"
}).execute().toArray().forEach(function (d) { }).execute().toArray().forEach(function (d) {
// ... /* ... */
}); });
} }
}); });
@ -100,12 +100,12 @@ db._executeTransaction({
action: function () { action: function () {
var db = require("@arangodb").db; var db = require("@arangodb").db;
// write into c1 (announced) /* write into c1 (announced) */
db.c1.insert({ foo: "bar" }); db.c1.insert({ foo: "bar" });
// some operation here that takes long to execute... /* some operation here that takes long to execute... */
// read from c2 (unannounced) /* read from c2 (unannounced) */
db.c2.toArray(); db.c2.toArray();
} }
}); });
@ -122,12 +122,12 @@ db._executeTransaction({
action: function () { action: function () {
var db = require("@arangodb").db; var db = require("@arangodb").db;
// write into c2 (announced) /* write into c2 (announced) */
db.c2.insert({ bar: "baz" }); db.c2.insert({ bar: "baz" });
// some operation here that takes long to execute... /* some operation here that takes long to execute... */
// read from c1 (unannounced) /* read from c1 (unannounced) */
db.c1.toArray(); db.c1.toArray();
} }
}); });