mirror of https://gitee.com/bigwinds/arangodb
fixed broken documentation
This commit is contained in:
parent
a1ba43172e
commit
752324db11
|
@ -1,25 +1,8 @@
|
|||
!CHAPTER ArangoDB Shell Output
|
||||
|
||||
In general the ArangoDB shell prints its output to the standard output channel
|
||||
using the JSON stringifier.
|
||||
|
||||
```
|
||||
arangosh> db.five.toArray();
|
||||
[{ "_id" : "five/3665447", "_rev" : "3665447", "name" : "one" },
|
||||
{ "_id" : "five/3730983", "_rev" : "3730983", "name" : "two" },
|
||||
{ "_id" : "five/3862055", "_rev" : "3862055", "name" : "four" },
|
||||
{ "_id" : "five/3993127", "_rev" : "3993127", "name" : "three" }]
|
||||
```
|
||||
|
||||
*start_pretty_print()*
|
||||
|
||||
While the standard JSON stringifier is very concise it is hard to read. Calling
|
||||
the function *start_pretty_print* will enable the pretty printer which
|
||||
formats the output in a human-readable way.
|
||||
|
||||
```
|
||||
arangosh> start_pretty_print();
|
||||
using pretty printing
|
||||
By default, the ArangoDB shell uses a pretty printer when JSON documents are
|
||||
printed. This ensures documents are printed in a human-readable way:
|
||||
```js
|
||||
arangosh> db.five.toArray();
|
||||
[
|
||||
{
|
||||
|
@ -45,7 +28,10 @@ arangosh> db.five.toArray();
|
|||
]
|
||||
```
|
||||
|
||||
*stop_pretty_print()*
|
||||
While the pretty-printer produces nice looking results, it will need a lot of
|
||||
screen space for each document. Sometimes, a more dense output might be better.
|
||||
In this case, the pretty printer can be turned off using the command
|
||||
*stop_pretty_print()*.
|
||||
|
||||
To turn on pretty printing again, use the *start_pretty_print()* command.
|
||||
|
||||
The function disables the pretty printer, switching back to the standard dense
|
||||
JSON output format.
|
|
@ -14,7 +14,7 @@ ArangoDB is a database that serves documents to clients.
|
|||
["joins"](../AqlExamples/Join.md) using many collections or graph structures
|
||||
* *Cursors* are used to iterate over the result of a query
|
||||
* *Indexes* are used to speed up of searches. There are various different
|
||||
types of indexes like [Index Hash](../IndexHandling/Hash.md), [Index Geo](../IndexHandling/Geo.md) and [Index BitArray](../IndexHandling/BitArray.md)
|
||||
types of indexes like [hash indexes](../IndexHandling/Hash.md), [geo indexes](../IndexHandling/Geo.md) and [bitarray indexes](../IndexHandling/BitArray.md)
|
||||
|
||||
If you are familiar with RDBMS then it is safe to compare collections
|
||||
to tables and documents to rows. However, bringing structure to the
|
||||
|
@ -28,18 +28,18 @@ embedded version in the browser. Using the command-line tool has the
|
|||
advantage that you can use autocompletion.
|
||||
|
||||
unix> arangosh --server.password ""
|
||||
_
|
||||
_
|
||||
__ _ _ __ __ _ _ __ __ _ ___ ___| |__
|
||||
/ _` | '__/ _` | '_ \ / _` |/ _ \/ __| '_ \
|
||||
| (_| | | | (_| | | | | (_| | (_) \__ \ | | |
|
||||
\__,_|_| \__,_|_| |_|\__, |\___/|___/_| |_|
|
||||
|___/
|
||||
|___/
|
||||
|
||||
Welcome to arangosh 1.x.y. Copyright (c) 2012 triAGENS GmbH.
|
||||
Using Google V8 3.9.4 JavaScript engine.
|
||||
Using READLINE 6.1.
|
||||
|
||||
Connected to Arango DB 127.0.0.1:8529 Version 1.x.y
|
||||
Connected to Arango DB 127.0.0.1:8529 Version 2.2.0
|
||||
|
||||
------------------------------------- Help -------------------------------------
|
||||
Predefined objects:
|
||||
|
@ -169,66 +169,59 @@ In order to create new documents in a collection use the *save*
|
|||
operation.
|
||||
|
||||
arangosh> db.example.save({ Hello : "World" });
|
||||
{ error : false, _id : "example/1512420", _key : "1512420", _rev : "1512420" }
|
||||
arangosh> db.example.save({ name : "John Doe", age : 29 });
|
||||
{ error : false, _id : "example/1774564", _key : "1774564", _rev : "1774564" }
|
||||
arangosh> db.example.save({ name : "Jane Smith", age : 31 });
|
||||
{ error : false, _id : "example/1993214", _key : "1993214", _rev : "1993214" }
|
||||
{ "error" : false, "_id" : "example/1512420", "_key" : "1512420", "_rev" : "1512420" }
|
||||
arangosh> db.example.save({ "name" : "John Doe", "age" : 29 });
|
||||
{ "error" : false, "_id" : "example/1774564", _key : "1774564", "_rev" : "1774564" }
|
||||
arangosh> db.example.save({ "name" : "Jane Smith", "age" : 31 });
|
||||
{ "error" : false, "_id" : "example/1993214", "_key" : "1993214", "_rev" : "1993214" }
|
||||
|
||||
Just storing documents would be no fun. We now want to select some of
|
||||
the stored documents again. In order to select all elements of a
|
||||
collection, one can use the *all* operator. Because this might return
|
||||
a lot of data, we switch on pretty printing before.
|
||||
collection, one can use the *toArray* method:
|
||||
|
||||
arangosh> start_pretty_print();
|
||||
use pretty printing
|
||||
|
||||
The command *stop_pretty_print()* will switch off pretty printing again.
|
||||
Now extract all elements:
|
||||
|
||||
arangosh> db.example.all().toArray()
|
||||
arangosh> db.example.toArray()
|
||||
[
|
||||
{
|
||||
_id : "example/6308263",
|
||||
_key : "1993214",
|
||||
_rev : "1993214",
|
||||
age : 31,
|
||||
name : "Jane Smith"
|
||||
"_id" : "example/1993214",
|
||||
"_key" : "1993214",
|
||||
"_rev" : "1993214",
|
||||
"age" : 31,
|
||||
"name" : "Jane Smith"
|
||||
},
|
||||
{
|
||||
_id : "example/6242727",
|
||||
_key : "1774564",
|
||||
_rev : "1774564",
|
||||
age : 29,
|
||||
name : "John Doe"
|
||||
"_id" : "example/1774564",
|
||||
"_key" : "1774564",
|
||||
"_rev" : "1774564",
|
||||
"age" : 29,
|
||||
"name" : "John Doe"
|
||||
},
|
||||
{
|
||||
_id : "example/5980583",
|
||||
_key : "1512420",
|
||||
_rev : "1512420",
|
||||
Hello : "World"
|
||||
"_id" : "example/1512420",
|
||||
"_key" : "1512420",
|
||||
"_rev" : "1512420",
|
||||
"Hello" : "World"
|
||||
}
|
||||
]
|
||||
|
||||
The last document was a mistake – so let's delete it:
|
||||
|
||||
arangosh> db.example.remove("example/5980583")
|
||||
arangosh> db.example.remove("example/1512420")
|
||||
true
|
||||
arangosh> db.example.all().toArray()
|
||||
arangosh> db.example.toArray()
|
||||
[
|
||||
{
|
||||
_id : "example/6308263",
|
||||
_key : "1993214",
|
||||
_rev : "1993214",
|
||||
age : 31,
|
||||
name : "Jane Smith"
|
||||
"_id" : "example/1993214",
|
||||
"_key" : "1993214",
|
||||
"_rev" : "1993214",
|
||||
"age" : 31,
|
||||
"name" : "Jane Smith"
|
||||
},
|
||||
{
|
||||
_id : "example/6242727",
|
||||
_key : "1774564",
|
||||
_rev : "1774564",
|
||||
age : 29,
|
||||
name : "John Doe"
|
||||
"_id" : "example/1774564",
|
||||
"_key" : "1774564",
|
||||
"_rev" : "1774564",
|
||||
"age" : 29,
|
||||
"name" : "John Doe"
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -239,40 +232,40 @@ matching a given example.
|
|||
arangosh> db.example.byExample({ name: "Jane Smith" }).toArray()
|
||||
[
|
||||
{
|
||||
_id : "example/6308263",
|
||||
_key : "1993214",
|
||||
_rev : "1993214",
|
||||
age : 31,
|
||||
name : "Jane Smith"
|
||||
"_id" : "example/1993214",
|
||||
"_key" : "1993214",
|
||||
"_rev" : "1993214",
|
||||
"age" : 31,
|
||||
"name" : "Jane Smith"
|
||||
}
|
||||
]
|
||||
|
||||
While the *byExample* works very well for simple queries where you
|
||||
combine the conditions with an `and`. The syntax above becomes messy for *joins*
|
||||
and *or* conditions. Therefore ArangoDB also supports a full-blown
|
||||
query language.
|
||||
query language, AQL. To run an AQL query, use the *db._query* method:.
|
||||
|
||||
arangosh> db._query('FOR user IN example FILTER user.name == "Jane Smith" RETURN user').toArray()
|
||||
[
|
||||
{
|
||||
_id : "example/6308263",
|
||||
_key : "1993214",
|
||||
_rev : "1993214",
|
||||
age : 31,
|
||||
name : "Jane Smith"
|
||||
"_id" : "example/1993214",
|
||||
"_key" : "1993214",
|
||||
"_rev" : "1993214",
|
||||
"age" : 31,
|
||||
"name" : "Jane Smith"
|
||||
}
|
||||
]
|
||||
|
||||
Search for all persons over 30:
|
||||
Searching for all persons with an age above 30:
|
||||
|
||||
arangosh> db._query('FOR user IN example FILTER user.age > 30 RETURN user').toArray()
|
||||
[
|
||||
{
|
||||
_id : "example/6308263",
|
||||
_key : "1993214",
|
||||
_rev : "1993214",
|
||||
age : 31,
|
||||
name : "Jane Smith"
|
||||
"_id" : "example/1993214",
|
||||
"_key" : "1993214",
|
||||
"_rev" : "1993214",
|
||||
"age" : 31,
|
||||
"name" : "Jane Smith"
|
||||
}
|
||||
]
|
||||
|
||||
|
@ -286,11 +279,6 @@ The ArangoDB server has a graphical front-end, which allows you to
|
|||
inspect the current state of the server from within your browser. You
|
||||
can use the front-end using the following URL:
|
||||
|
||||
http://localhost:8529/_admin/html/index.html
|
||||
|
||||
Unless you have loaded an application into the ArangoDB server – which remaps
|
||||
the paths – the front-end will also be available under
|
||||
|
||||
http://localhost:8529/
|
||||
|
||||
The front-end allows you to browse through the collections and
|
||||
|
|
Loading…
Reference in New Issue