mirror of https://gitee.com/bigwinds/arangodb
141 lines
4.5 KiB
HTML
141 lines
4.5 KiB
HTML
<html><head><title>ArangoDB Manual</title> <style media="screen" type="text/css" style="display:none">body{background-color:white;font:13px Helvetica,arial,freesans,clean,sans-serif;line-height:1.4;color:#333;}#access{font-size:16px;margin-left:12px;display:block;margin-left:10px;margin-right:10px;background-color:#F3F1EE!important;}#access a{border-right:1px solid #DBDEDF;color:#A49F96;display:block;line-height:38px;padding:0 10px;text-decoration:none;}#navigation ul{text-transform:uppercase;list-style:none;margin:0;}#navigation li{float:left;position:relative;}#container{width:920px;margin:0 auto;}a{color:#4183C4;text-decoration:none;}.contents h2{font-size:24px;border-bottom:1px solid #CCC;color:black;}.contents h1{font-size:33px;border-bottom:1px solid #CCC;color:black;}.clearfix:after{content:".";display:block;clear:both;font-size:0;height:0;visibility:hidden;}/**/ *:first-child+html .clearfix{min-height:0;}/**/ * html .clearfix{height:1%;}</style></head><body><div id="container"><img src="images/logo_arangodb.png" width="397" height="67" alt="ArangoDB"><div id="access" role="navigation"><div id="navigation"><ul id="menu-ahome" class="menu"><li><a href="Home.html">Table of contents</a></li> <li><a href="http://www.arangodb.org">ArangoDB homepage</a></li></ul></div><div class="clearfix"></div></div><div>
|
|
<!-- Generated by Doxygen 1.7.3 -->
|
|
</div>
|
|
<div class="header">
|
|
<div class="headertitle">
|
|
<h1>Preparing the Examples </h1> </div>
|
|
</div>
|
|
<div class="contents">
|
|
<div class="textblock"><p>Some examples in the manuals assume that you have created the following collections:</p>
|
|
<ul>
|
|
<li>demo</li>
|
|
<li>five</li>
|
|
<li>geo</li>
|
|
</ul>
|
|
<p>Some of the examples may destroy the collection. In that case you can use one of the following script to restore the collection.</p>
|
|
<p><code>examples.js</code>: A JavaScript script usable within the ArangoDB shell to regenerate the above collections.</p>
|
|
<p><code>examples.sh</code>: A shell script using curl to setup the collections. The script works without any additional client, but will not be able to detect any errors.</p>
|
|
<h2><a class="anchor" id="ExamplesSetupDemo"></a>
|
|
Collection "demo"</h2>
|
|
<div class="fragment"><pre class="fragment">avocsh> db.demo.all();
|
|
[
|
|
{
|
|
_id : "161039/4323870",
|
|
_rev : 4323870,
|
|
name : "Hugo",
|
|
firstName : "Egon",
|
|
address : {
|
|
city : "Hier",
|
|
street : "Neue Strasse"
|
|
},
|
|
hobbies : [
|
|
"swimming",
|
|
"programming"
|
|
]
|
|
},
|
|
|
|
{
|
|
_id : "161039/4192798",
|
|
_rev : 4192798,
|
|
hallo : "world"
|
|
},
|
|
|
|
{
|
|
_id : "161039/4258334",
|
|
_rev : 4258334,
|
|
world : "hallo"
|
|
}
|
|
]
|
|
</pre></div><p>was generated by</p>
|
|
<div class="fragment"><pre class="fragment"></pre></div><h2><a class="anchor" id="ExamplesSetupFive"></a>
|
|
Collection "five"</h2>
|
|
<p>The collection "five" has a unique constraint on the attribute <code>a</code>, and a second unique constraint on the attribute <code>b</code>.</p>
|
|
<div class="fragment"><pre class="fragment">avocsh> db.five.all();
|
|
[
|
|
{
|
|
_id : "138663/2631399",
|
|
_rev : 2631399,
|
|
a : 2,
|
|
b : "Two"
|
|
},
|
|
|
|
{
|
|
_id : "138663/2828007",
|
|
_rev : 2828007,
|
|
a : 5,
|
|
b : "Five"
|
|
},
|
|
|
|
{
|
|
_id : "138663/2696935",
|
|
_rev : 2696935,
|
|
a : 3,
|
|
b : "Three"
|
|
},
|
|
|
|
{
|
|
_id : "138663/2565863",
|
|
_rev : 2565863,
|
|
a : 1,
|
|
b : "One"
|
|
},
|
|
|
|
{
|
|
_id : "138663/2762471",
|
|
_rev : 2762471,
|
|
a : 4,
|
|
b : "Four"
|
|
}
|
|
]
|
|
</pre></div><p>was generated by</p>
|
|
<div class="fragment"><pre class="fragment"></pre></div><h2><a class="anchor" id="ExamplesSetupGeo"></a>
|
|
Collection "geo"</h2>
|
|
<p>The collection "geo" has two geo fields, one <code>home</code> being a list with two elements, one <code>work</code> being an hash array with latitude <code>b</code> and longitude <code>l</code>.</p>
|
|
<div class="fragment"><pre class="fragment">[
|
|
{
|
|
_id : "154092/301894631",
|
|
_rev : 301894631,
|
|
work : {
|
|
b : -70,
|
|
l : -30
|
|
},
|
|
name : "Name/-70/-30",
|
|
home : [
|
|
-70,
|
|
-30
|
|
]
|
|
},
|
|
|
|
{
|
|
_id : "154092/305433575",
|
|
_rev : 305433575,
|
|
work : {
|
|
b : -60,
|
|
l : 140
|
|
},
|
|
name : "Name/-60/140",
|
|
home : [
|
|
-60,
|
|
140
|
|
]
|
|
},
|
|
|
|
{
|
|
_id : "154092/314215399",
|
|
_rev : 314215399,
|
|
work : {
|
|
b : -20,
|
|
l : 0
|
|
},
|
|
name : "Name/-20/0",
|
|
home : [
|
|
-20,
|
|
0
|
|
]
|
|
},
|
|
...
|
|
]
|
|
</pre></div><p>was generated by</p>
|
|
<div class="fragment"><pre class="fragment"></pre></div> </div></div>
|
|
</div></body></html>
|