1
0
Fork 0

Merge branch 'devel' of https://github.com/triAGENS/ArangoDB into devel

This commit is contained in:
Jan Steemann 2014-06-23 13:22:56 +02:00
commit c930740862
10 changed files with 251 additions and 226 deletions

View File

@ -13,15 +13,52 @@ migrations will also be detailed here.
* Foxx: The usage of `controller.collection` is no longer suggested, it will be deprecated in the next version. Please use `appContext.collection` instead.
* Foxx: The usage of `apps` in manifest files is no longer possible, please use `controllers` instead.
* Graph: The usage of the modules `org/arangodb/graph` and `org/arangodb/graph-blueprint` is no longer suggested, it will be deprecated in the next version. Please use module `org/arangodb/general-graph` instead.
* Graph: The module `org/arangodb/graph` will now load the module `org/arangodb/graph-blueprint`.
* AQL: The function `PATHS` is no longer suggested, it will be deprecated in the next version. Please use `GRAPH_PATHS` instead.
* AQL: The function `SHORTEST_PATH` is no longer suggested, it will be deprecated in the next version. Please use `GRAPH_SHORTEST_PATH` instead.
* AQL: The function `TRAVERSAL` is no longer suggested, it will be deprecated in the next version. Please use `GRAPH_TRAVERSAL` instead.
* AQL: The function `TRAVERSAL_TREE` is no longer suggested, it will be deprecated in the next version. Please use `GRAPH_TRAVERSAL_TREE` instead.
* AQL: The function `NEIGHBORS` is no longer suggested, it will be deprecated in the next version. Please use `GRAPH_NEIGHBORS` instead.
* Traversal: The usage of the traversal datasource `collectionDatasourceFactory` is no longer suggested, it will be deprecated in the next version. Please use `generalGraphDatasourceFactory` instead.
* Http: The api `_api/graph` is no longer suggested, it will be deprecated in the next version. Please use the general graph api `_api/gharial` instead.
* Http: In `POST _api/traversal` the usage of the body parameter `edgeCollection` is no longer suggested, it will be deprecated in the next version. Please use `graphName` instead.
## 2.3
* Foxx: `controller.collection` is now deprecated, it will raise a warning if you use it. To suppress the warning, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `appContext.collection` instead.
* Graph: The modules `org/arangodb/graph` and `org/arangodb/graph-blueprint` are now deprecated, it will raise a warning if you use it. To suppress the warning, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use module `org/arangodb/general-graph` instead.
* AQL: The function `PATHS` is now deprecated, it will raise a warning if you use it. To suppress the warning, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `GRAPH_PATHS` instead.
* AQL: The function `SHORTEST_PATH` is now deprecated, it will raise a warning if you use it. To suppress the warning, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `GRAPH_SHORTEST_PATH` instead.
* AQL: The function `TRAVERSAL` is now deprecated, it will raise a warning if you use it. To suppress the warning, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `GRAPH_TRAVERSAL` instead.
* AQL: The function `TRAVERSAL_TREE` is now deprecated, it will raise a warning if you use it. To suppress the warning, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `GRAPH_TRAVERSAL_TREE` instead.
* AQL: The function `NEIGHBORS` is now deprecated, it will raise a warning if you use it. To suppress the warning, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `GRAPH_NEIGHBORS` instead.
* Traversal: The usage of the traversal datasource `collectionDatasourceFactory` is now deprecated, it will raise a warning if you use it. To suppress the warning, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `generalGraphDatasourceFactory` instead.
* Http: The api `_api/graph` is now deprecated, it will raise a warning if you use it. To suppress the warning, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use the general graph api `_api/gharial` instead.
* Http: In `POST _api/traversal` the usage of the body parameter `edgeCollection` is now deprecated, it will raise a warning if you use it. To suppress the warning, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `graphName` instead.
## 2.4
* Foxx: `controller.collection` is no longer available by default. If you still want to use it, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `appContext.collection` instead.
* Graph: The modules `org/arangodb/graph` and `org/arangodb/graph-blueprint` are no longer available by default. If you still want to use them, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use module `org/arangodb/general-graph` instead.
* AQL: The function `PATHS` is no longer available by default. If you still want to use it, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `GRAPH_PATHS` instead.
* AQL: The function `SHORTEST_PATH` is no longer available by default. If you still want to use it, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `GRAPH_SHORTEST_PATH` instead.
* AQL: The function `TRAVERSAL` is no longer available by default. If you still want to use it, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `GRAPH_TRAVERSAL` instead.
* AQL: The function `TRAVERSAL_TREE` is no longer available by default. If you still want to use it, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `GRAPH_TRAVERSAL_TREE` instead.
* AQL: The function `NEIGHBORS` is no longer available by default. If you still want to use it, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `GRAPH_NEIGHBORS` instead.
* Traversal: The usage of the traversal datasource `collectionDatasourceFactory` is no longer available by default. If you still want to use it. Please use `generalGraphDatasourceFactory` instead.
* Http: The api `_api/graph` is no longer available by default. If you still want to use it, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use the general graph api `_api/gharial` instead.
* Http: In `POST _api/traversal` the usage of the body parameter `edgeCollection` is no longer available by default. If you still want to use it, please start `arangod` with the option `--server.default-api-compatibility 20200`. Please use `graphName` instead.
## 2.5
* Foxx: `controller.collection` has been removed entirely. Please use `appContext.collection` instead.
* Graph: The modules `org/arangodb/graph` and `org/arangodb/graph-blueprint` have been removed entirely. Please use module `org/arangodb/general-graph` instead.
* AQL: The function `PATHS` has been removed entirely. Please use `GRAPH_PATHS` instead.
* AQL: The function `SHORTEST_PATH` has been removed entirely. Please use `GRAPH_SHORTEST_PATH` instead.
* AQL: The function `TRAVERSAL` has been removed entirely. Please use `GRAPH_TRAVERSAL` instead.
* AQL: The function `TRAVERSAL_TREE` has been removed entirely. Please use `GRAPH_TRAVERSAL_TREE` instead.
* AQL: The function `NEIGHBORS` has been removed entirely. Please use `GRAPH_NEIGHBORS` instead.
* Traversal: The usage of the traversal datasource `collectionDatasourceFactory` has been removed entirely. Please use `generalGraphDatasourceFactory` instead.
* Http: The api `_api/graph` has been removed entirely. Please use the general graph api `_api/gharial` instead.
* Http: In `POST _api/traversal` the usage of the body parameter `edgeCollection` has been removed entirely. Please use `graphName` instead.

View File

@ -16,36 +16,36 @@
* [Collections](FirstSteps/CollectionsAndDocuments.md)
<!-- 3 -->
* [ArangoDB Web Interface](WebInterface/README.md)
* [Some Features](WebInterface/Features.md)
* [Some Features](WebInterface/Features.md)
<!-- 4 -->
* [Handling Databases](Databases/README.md)
* [Working with Databases](Databases/WorkingWith.md)
* [Notes about Databases](Databases/Notes.md)
* [Working with Databases](Databases/WorkingWith.md)
* [Notes about Databases](Databases/Notes.md)
<!-- 5 -->
* [Handling Collections](Collections/README.md)
* [Collection Methods](Collections/CollectionMethods.md)
* [Database Methods](Collections/DatabaseMethods.md)
* [Collection Methods](Collections/CollectionMethods.md)
* [Database Methods](Collections/DatabaseMethods.md)
<!-- 6 -->
* [Handling Documents](Documents/README.md)
* [Address and ETag](Documents/DocumentAddress.md)
* [Collection Methods](Documents/DocumentMethods.md)
* [Database Methods](Documents/DatabaseMethods.md)
* [Address and ETag](Documents/DocumentAddress.md)
* [Collection Methods](Documents/DocumentMethods.md)
* [Database Methods](Documents/DatabaseMethods.md)
<!-- 7 -->
* [Handling Edges](Edges/README.md)
<!-- 8 -->
* [Simple Queries](SimpleQueries/README.md)
* [Geo Queries](SimpleQueries/GeoQueries.md)
* [Fulltext Queries](SimpleQueries/FulltextQueries.md)
* [Pagination](SimpleQueries/Pagination.md)
* [Sequential Access](SimpleQueries/Access.md)
* [Modification Queries](SimpleQueries/ModificationQueries.md)
* [Geo Queries](SimpleQueries/GeoQueries.md)
* [Fulltext Queries](SimpleQueries/FulltextQueries.md)
* [Pagination](SimpleQueries/Pagination.md)
* [Sequential Access](SimpleQueries/Access.md)
* [Modification Queries](SimpleQueries/ModificationQueries.md)
<!-- 9 -->
* [Transactions](Transactions/README.md)
* [Transaction invocation](Transactions/TransactionInvocation.md)
* [Passing parameters](Transactions/Passing.md)
* [Locking and isolation](Transactions/LockingAndIsolation.md)
* [Durability](Transactions/Durability.md)
* [Limitations](Transactions/Limitations.md)
* [Transaction invocation](Transactions/TransactionInvocation.md)
* [Passing parameters](Transactions/Passing.md)
* [Locking and isolation](Transactions/LockingAndIsolation.md)
* [Durability](Transactions/Durability.md)
* [Limitations](Transactions/Limitations.md)
<!-- 10 -->
* [AQL](Aql/README.md)
* [How to invoke AQL](Aql/Invoke.md)
@ -57,47 +57,47 @@
* [Advanced Features](Aql/Advanced.md)
<!-- 11 -->
* [Extending AQL](AqlExtending/README.md)
* [Conventions](AqlExtending/Conventions.md)
* [Registering Functions](AqlExtending/Functions.md)
* [Conventions](AqlExtending/Conventions.md)
* [Registering Functions](AqlExtending/Functions.md)
<!-- 12 -->
* [AQL Examples](AqlExamples/README.md)
* [Examples](AqlExamples/Examples.md)
* [Collection based queries](AqlExamples/CollectionQueries.md)
* [Projections and filters](AqlExamples/ProjectionsAndFilters.md)
* [Joins](AqlExamples/Join.md)
* [Grouping](AqlExamples/Grouping.md)
* [Examples](AqlExamples/Examples.md)
* [Collection based queries](AqlExamples/CollectionQueries.md)
* [Projections and filters](AqlExamples/ProjectionsAndFilters.md)
* [Joins](AqlExamples/Join.md)
* [Grouping](AqlExamples/Grouping.md)
<!-- 13 -->
* [Blueprint Graphs](Blueprint-Graphs/README.md)
* [Graph Constructor](Blueprint-Graphs/GraphConstructor.md)
* [Vertex Methods](Blueprint-Graphs/VertexMethods.md)
* [Edge Methods](Blueprint-Graphs/EdgeMethods.md)
* [Graph Constructor](Blueprint-Graphs/GraphConstructor.md)
* [Vertex Methods](Blueprint-Graphs/VertexMethods.md)
* [Edge Methods](Blueprint-Graphs/EdgeMethods.md)
<!-- 14 -->
* [General Graphs](General-Graphs/README.md)
* [Functions](General-Graphs/GeneralGraphFunctions.md)
* [Fluent Query Interface](General-Graphs/FluentAQLInterface.md)
* [Fluent Query Interface](General-Graphs/FluentAQLInterface.md)
<!-- 15 -->
* [Traversals](Traversals/README.md)
* [Starting from Scratch](Traversals/StartingFromScratch.md)
* [Using Traversal Objects](Traversals/UsingTraversalObjects.md)
* [Example Data](Traversals/ExampleData.md)
* [Starting from Scratch](Traversals/StartingFromScratch.md)
* [Using Traversal Objects](Traversals/UsingTraversalObjects.md)
* [Example Data](Traversals/ExampleData.md)
<!-- 17 -->
* [Foxx](Foxx/README.md)
* [Handling Request](Foxx/HandlingRequest.md)
* [Handling Request](Foxx/HandlingRequest.md)
* [Manifest](Foxx/FoxxManifest.md)
* [FoxxController](Foxx/FoxxController.md)
* [FoxxModel](Foxx/FoxxModel.md)
* [FoxxRepository](Foxx/FoxxRepository.md)
* [Developing Applications](Foxx/DevelopingAnApplication.md)
* [Deploying Applications](Foxx/DeployingAnApplication.md)
* [Optional Functionlity](Foxx/FoxxOptional.md)
* [FoxxController](Foxx/FoxxController.md)
* [FoxxModel](Foxx/FoxxModel.md)
* [FoxxRepository](Foxx/FoxxRepository.md)
* [Developing Applications](Foxx/DevelopingAnApplication.md)
* [Deploying Applications](Foxx/DeployingAnApplication.md)
* [Optional Functionality](Foxx/FoxxOptional.md)
<!-- 18 -->
* [Foxx Manager](FoxxManager/README.md)
* [First Steps](FoxxManager/FirstSteps.md)
* [Behind the scenes](FoxxManager/BehindTheScenes.md)
* [Multiple Databases](FoxxManager/MultipleDatabases.md)
* [Foxx Applications](FoxxManager/ApplicationsAndReplications.md)
* [Manager Commands](FoxxManager/ManagerCommands.md)
* [Frequently Used Options](FoxxManager/FrequentlyUsedOptions.md)
* [First Steps](FoxxManager/FirstSteps.md)
* [Behind the scenes](FoxxManager/BehindTheScenes.md)
* [Multiple Databases](FoxxManager/MultipleDatabases.md)
* [Foxx Applications](FoxxManager/ApplicationsAndReplications.md)
* [Manager Commands](FoxxManager/ManagerCommands.md)
* [Frequently Used Options](FoxxManager/FrequentlyUsedOptions.md)
<!-- 19 -->
* [ArangoDB's Actions](ArangoActions/README.md)
<!-- 20 -->
@ -109,15 +109,15 @@
* [Replication Events](Replication/Events.md)
<!-- 21 -->
* [Sharding](Sharding/README.md)
* [How to try it out](Sharding/HowTo.md)
* [Implementation](Sharding/StatusOfImplementation.md)
* [Authentication](Sharding/Authentication.md)
* [Firewall setup](Sharding/FirewallSetup.md)
* [How to try it out](Sharding/HowTo.md)
* [Implementation](Sharding/StatusOfImplementation.md)
* [Authentication](Sharding/Authentication.md)
* [Firewall setup](Sharding/FirewallSetup.md)
<!-- 22 -->
* [Configure ArangoDB](ConfigureArango/README.md)
* [General options](ConfigureArango/GeneralOptions.md)
* [Arangod options](ConfigureArango/Arangod.md)
* [Endpoints options](ConfigureArango/Endpoint.md)
* [Endpoints options](ConfigureArango/Endpoint.md)
* [Development options](ConfigureArango/Development.md)
* [Cluster options](ConfigureArango/Cluster.md)
* [Logging options](ConfigureArango/Logging.md)
@ -130,14 +130,14 @@
<!-- 24 -->
* [Arangodump](Arangodump/README.md)
<!-- 25 -->
* [Arangorestore](Arangorestore/README.md)
* [Arangorestore](Arangorestore/README.md)
<!-- 26 -->
* [HTTP API](HttpApi/README.md)
* [Databases](HttpDatabase/README.md)
* [To-Endpoint](HttpDatabase/DatabaseEndpoint.md)
* [Management](HttpDatabase/DatabaseManagement.md)
* [Managing (http)](HttpDatabase/ManagingDatabasesUsingHttp.md)
* [Note on Databases](HttpDatabase/NotesOnDatabases.md)
* [Note on Databases](HttpDatabase/NotesOnDatabases.md)
* [Documents](HttpDocument/README.md)
* [Address and ETag](HttpDocument/AddressAndEtag.md)
* [Working with](HttpDocument/WorkingWithDocuments.md)
@ -159,10 +159,10 @@
* [Address of an Index](HttpIndexes/Address.md)
* [Working with Indexes](HttpIndexes/WorkingWith.md)
* [Cap Constraints](HttpIndexes/Cap.md)
* [Hash](HttpIndexes/Hash.md)
* [Skiplist](HttpIndexes/Skiplist.md)
* [Geo](HttpIndexes/Geo.md)
* [Fulltext](HttpIndexes/Fulltext.md)
* [Hash](HttpIndexes/Hash.md)
* [Skiplist](HttpIndexes/Skiplist.md)
* [Geo](HttpIndexes/Geo.md)
* [Fulltext](HttpIndexes/Fulltext.md)
* [Transactions](HttpTransaction/README.md)
* [Graphs](HttpGraphs/README.md)
* [Vertex](HttpGraphs/Vertex.md)
@ -213,9 +213,9 @@
* [Datafile Debugger](DatafileDebugger/README.md)
<!-- 31 -->
* [Naming Conventions](NamingConventions/README.md)
* [Database Names](NamingConventions/DatabaseNames.md)
* [Collection Names](NamingConventions/CollectionNames.md)
* [Document Keys](NamingConventions/DocumentKeys.md)
* [Attribute Names](NamingConventions/AttributeNames.md)
* [Database Names](NamingConventions/DatabaseNames.md)
* [Collection Names](NamingConventions/CollectionNames.md)
* [Document Keys](NamingConventions/DocumentKeys.md)
* [Attribute Names](NamingConventions/AttributeNames.md)
<!-- 32 -->
* [Error codes and meanings](ErrorCodes/README.md)

View File

@ -1,18 +1,7 @@
!CHAPTER Collection Methods
`collection.drop()`
Drops a collection and all its indexes.
*Examples*
Drops a collection:
arango> col = db.examples;
[ArangoCollection 109757, "examples" (status unloaded)]
arango> col.drop()
arango> col;
[ArangoCollection 109757, "examples" (status deleted)]
<!-- v8-vocbase.cpp -->
@startDocuBlock collection_drop
`collection.truncate()`
@ -34,78 +23,11 @@ arango> col.count();
0
```
`collection.properties()`
<!-- v8-vocbase.cpp -->
@startDocuBlock collection_properties
Returns an object containing all collection properties.
* waitForSync: If true creating a document will only return after the data was synced to disk.
* journalSize : The size of the journal in bytes.
* isVolatile: If true then the collection data will be kept in memory only and ArangoDB will not write or sync the data to disk.
* keyOptions (optional) additional options for key generation. This is a JSON array containing the following attributes (note: some of the attributes are optional):
* type: the type of the key generator used for the collection.
* allowUserKeys: if set to true, then it is allowed to supply own key values in the _key attribute of a document. If set to false, then the key generator will solely be responsible for generating keys and supplying own key values in the _key attribute of documents is considered an error.
* increment: increment value for autoincrement key generator. Not used for other key generator types.
* offset: initial offset value for autoincrement key generator. Not used for other key generator types.
* collection.properties( properties)
Changes the collection properties. properties must be a object with one or more of the following attribute(s):
* waitForSync: If true creating a document will only return after the data was synced to disk.
* journalSize : The size of the journal in bytes.
Note that it is not possible to change the journal size after the journal or datafile has been created. Changing this parameter will only effect newly created journals. Also note that you cannot lower the journal size to less then size of the largest document already stored in the collection.
Note: some other collection properties, such as type, isVolatile, or keyOptions cannot be changed once the collection is created.
*Examples*
Read all properties
arango> db.examples.properties()
{ "waitForSync" : false, "journalSize" : 33554432, "isVolatile" : false }
Change a property
arango> db.examples.properties({ waitForSync : false })
{ "waitForSync" : false, "journalSize" : 33554432, "isVolatile" : false }
`collection.figures()`
Returns an object containing all collection figures.
* alive.count: The number of living documents.
* alive.size: The total size in bytes used by all living documents.
* dead.count: The number of dead documents.
* dead.size: The total size in bytes used by all dead documents.
* dead.deletion: The total number of deletion markers.
* datafiles.count: The number of active datafiles.
* datafiles.fileSize: The total filesize of the active datafiles.
* journals.count: The number of journal files.
* journals.fileSize: The total filesize of the journal files.
* compactors.count: The number of compactor files.
* compactors.fileSize: The total filesize of the compactor files.
* shapefiles.count: The number of shape files.
* shapefiles.fileSize: The total filesize of the shape files.
* shapes.count: The total number of shapes used in the collection (this includes shapes that are not in use anymore)
* shapes.fileSize: The total filesize of the shapes files.
* attributes.count: The total number of attributes used in the collection (this includes attributes that are not in use anymore)
*Examples*
arango> db.demo.figures()
{ "alive" : { "count" : 1000, "size" : 45000 }, "dead" : { "count" : 0, "size" : 0, "deletion" : 0 }, "datafiles" : { "count" : 0, "fileSize" : 0 }, "journals" : { "count" : 1, "fileSize" : 33554432 }, "shapes" : { "count" : 7 } }
`collection.load()`
Loads a collection into memory.
*Examples*
arango> col = db.example;
[ArangoCollection 164208316, "example" (status unloading)]
arango> col.load();
arango> col;
[ArangoCollection 164208316, "example" (status loaded)]
<!-- v8-vocbase.cpp -->
@startDocuBlock collection_figures
`collection.reserve( number)`
@ -115,16 +37,8 @@ The reserve hint can be sent before a mass insertion into the collection is star
Not all indexes implement the reserve function at the moment. The indexes that don't implement it will simply ignore the request. returns the revision id of a collection
`collection.revision()`
Returns the revision id of the collection
The revision id is updated when the document data is modified, either by inserting, deleting, updating or replacing documents in it.
The revision id of a collection can be used by clients to check whether data in a collection has changed or if it is still unmodified since a previous fetch of the revision id.
The revision id returned is a string value. Clients should treat this value as an opaque string, and only use it for equality/non-equality comparisons.
<!-- v8-vocbase.cpp -->
@startDocuBlock collection_revision
`collection.checksum( withRevisions, withData)`
@ -134,36 +48,14 @@ If the optional argument withRevisions is set to true, then the revision ids of
If the optional argument withData is set to true, then the actual document data is also checksummed. Including the document data in checksumming will make the calculation slower, but is more accurate.
`collection.unload()`
Starts unloading a collection from memory. Note that unloading is deferred until all query have finished.
*Examples*
arango> col = db.example;
[ArangoCollection 164208316, "example" (status loaded)]
arango> col.unload();
arango> col;
[ArangoCollection 164208316, "example" (status unloaded)]
`collection.rename( new-name)`
Renames a collection using the new-name. The new-name must not already be used for a different collection. new-name must also be a valid collection name. For more information on valid collection names please refer to Naming Conventions in ArangoDB.
If renaming fails for any reason, an error is thrown.
*Examples*
arango> c = db.example;
[ArangoCollection 68519, "example" (status new born)]
arango> c.rename("better-example");
arango> c;
[ArangoCollection 68519, "better-example" (status new born)]
`collection.rotate()`
Rotates the current journal of a collection (i.e. makes the journal a read-only datafile). The purpose of the rotation is to include the datafile in a following compaction run and perform earlier garbage collection.
<!-- v8-vocbase.cpp -->
@startDocuBlock collection_unload
<!-- v8-vocbase.cpp -->
@startDocuBlock collection_rename
<!-- v8-vocbase.cpp -->
@startDocuBlock collection_rotate
<!--
@anchor HandlingCollectionsDrop

View File

@ -5776,7 +5776,7 @@ static v8::Handle<v8::Value> DropVocbaseColCoordinator (TRI_vocbase_col_t* colle
///
/// Drops a *collection* and all its indexes.
///
/// @EEXAMPLES
/// @EXAMPLES
///
/// @verbinclude shell_collection-drop
////////////////////////////////////////////////////////////////////////////////
@ -6021,7 +6021,7 @@ static TRI_doc_collection_info_t* GetFigures (TRI_vocbase_col_t* collection) {
////////////////////////////////////////////////////////////////////////////////
/// @brief returns the figures of a collection
/// @startDocuBlock clollection_figures
/// @startDocuBlock collection_figures
/// `collection.figures()`
///
/// Returns an object containing all collection figures.

View File

@ -191,11 +191,11 @@ var wrapCollection = function(col) {
/// *Examples* are used to filter the result set for objects that match the conditions.
/// These *examples* can have the following values:
///
/// * Empty, there is no matching executed all found results are valid.
/// * A string, only the result having this value as it's *_id* is returned.
/// * An example object, defining a set of attributes.
/// * *Null*, there is no matching executed all found results are valid.
/// * A *string*, only the result having this value as it's *_id* is returned.
/// * An example *object*, defining a set of attributes.
/// Only results having these attributes are matched.
/// * A list containing example objects and/or strings.
/// * A *list* containing example *objects* and/or *strings*.
/// All results matching at least one of the elements in the list are returned.
///
/// @endDocuBlock
@ -684,7 +684,7 @@ AQLGenerator.prototype.vertices = function(example) {
///
/// *Examples*
///
/// To request unfiltered starting vertices:
/// To request unfiltered source vertices:
///
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphFluentAQLFromVerticesUnfiltered}
/// var examples = require("org/arangodb/graph-examples/example-graph.js");
@ -693,7 +693,7 @@ AQLGenerator.prototype.vertices = function(example) {
/// query.fromVertices().toArray();
/// @END_EXAMPLE_ARANGOSH_OUTPUT
///
/// To request filtered starting vertices by a single example:
/// To request filtered source vertices by a single example:
///
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphFluentAQLFromVerticesFilteredSingle}
/// var examples = require("org/arangodb/graph-examples/example-graph.js");
@ -702,7 +702,7 @@ AQLGenerator.prototype.vertices = function(example) {
/// query.fromVertices({name: "Alice"}).toArray();
/// @END_EXAMPLE_ARANGOSH_OUTPUT
///
/// To request filtered starting vertices by multiple examples:
/// To request filtered source vertices by multiple examples:
///
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphFluentAQLFromVerticesFilteredMultiple}
/// var examples = require("org/arangodb/graph-examples/example-graph.js");
@ -747,7 +747,7 @@ AQLGenerator.prototype.fromVertices = function(example) {
///
/// *Examples*
///
/// To request unfiltered starting vertices:
/// To request unfiltered target vertices:
///
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphFluentAQLToVerticesUnfiltered}
/// var examples = require("org/arangodb/graph-examples/example-graph.js");
@ -756,22 +756,22 @@ AQLGenerator.prototype.fromVertices = function(example) {
/// query.toVertices().toArray();
/// @END_EXAMPLE_ARANGOSH_OUTPUT
///
/// To request filtered starting vertices by a single example:
/// To request filtered target vertices by a single example:
///
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphFluentAQLToVerticesFilteredSingle}
/// var examples = require("org/arangodb/graph-examples/example-graph.js");
/// var g = examples.loadGraph("social");
/// var query = g._edges({type: "married"});
/// query.toVertices({name: "Alice"}).toArray();
/// query.toVertices({name: "Bob"}).toArray();
/// @END_EXAMPLE_ARANGOSH_OUTPUT
///
/// To request filtered starting vertices by multiple examples:
/// To request filtered target vertices by multiple examples:
///
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphFluentAQLToVerticesFilteredMultiple}
/// var examples = require("org/arangodb/graph-examples/example-graph.js");
/// var g = examples.loadGraph("social");
/// var query = g._edges({type: "married"});
/// query.toVertices([{name: "Alice"}, {name: "Charly"}]).toArray();
/// query.toVertices([{name: "Bob"}, {name: "Diana"}]).toArray();
/// @END_EXAMPLE_ARANGOSH_OUTPUT
/// @endDocuBlock
///
@ -980,6 +980,8 @@ AQLGenerator.prototype._getLastRestrictableStatementInfo = function() {
/// Restriction is only applied to this one part of the query.
/// It does not effect earlier or later statements.
///
/// *Parameter*
///
/// * *restrictions*: Define either one or a list of collections in the graph.
/// Only elements from these collections are taken into account for the result.
///
@ -1229,7 +1231,9 @@ AQLGenerator.prototype.count = function() {
/// var examples = require("org/arangodb/graph-examples/example-graph.js");
/// var g = examples.loadGraph("social");
/// var query = g._vertices();
/// while (query.hasNext()) {query.next();}
/// | while (query.hasNext()) {
/// | query.next();
/// }
/// @END_EXAMPLE_ARANGOSH_OUTPUT
/// @endDocuBlock
///
@ -1299,6 +1303,8 @@ AQLGenerator.prototype.next = function() {
/// edges in any direction between any pair of vertices within the
/// *vertexCollections*.
///
/// *Parameter*
///
/// * *relationName*: The name of the edge collection where the edges should be stored.
/// Will be created if it does not yet exist.
/// * *vertexCollections*: One or a list of collection names for which connections are allowed.
@ -1366,6 +1372,8 @@ var _undirectedRelation = function (relationName, vertexCollections) {
/// Relations are only allowed in the direction from any collection in *fromVertexCollections*
/// to any collection in *toVertexCollections*.
///
/// *Parameter*
///
/// * *relationName*: The name of the edge collection where the edges should be stored.
/// Will be created if it does not yet exist.
/// * *fromVertexCollections*: One or a list of collection names. Source vertices for the edges
@ -1657,6 +1665,7 @@ var _create = function (graphName, edgeDefinitions, orphanCollections) {
'edgeDefinitions' : edgeDefinitions,
'_key' : graphName
});
require("internal").print("precreate");
return new Graph(graphName, edgeDefinitions, collections[0], collections[1], orphanCollections);
};
@ -1782,6 +1791,7 @@ var bindEdgeCollections = function(self, edgeCollections) {
var bindVertexCollections = function(self, vertexCollections) {
_.each(vertexCollections, function(key) {
require("internal").print("each resolved");
var obj = db._collection(key);
var result;
var wrap = wrapCollection(obj);
@ -1875,9 +1885,19 @@ var updateBindCollections = function(graph) {
bindVertexCollections(graph, edgeDef.to);
}
);
require("internal").print("preVertex");
bindVertexCollections(graph, graph.__orphanCollections);
};
////////////////////////////////////////////////////////////////////////////////
/// internal helper to sort a graph's edge definitions
////////////////////////////////////////////////////////////////////////////////
var sortEdgeDefinition = function(edgeDefinition) {
edgeDefinition.from = edgeDefinition.from.sort();
edgeDefinition.to = edgeDefinition.to.sort();
return edgeDefinition;
};
////////////////////////////////////////////////////////////////////////////////
/// @startDocuBlock JSF_general_graph_vertex_collection_save
/// `graph.vertexCollectionName.save(data)`
@ -2077,6 +2097,13 @@ var updateBindCollections = function(graph) {
///
////////////////////////////////////////////////////////////////////////////////
var Graph = function(graphName, edgeDefinitions, vertexCollections, edgeCollections, orphanCollections) {
edgeDefinitions.forEach(
function(eD, index) {
var tmp = sortEdgeDefinition(eD);
edgeDefinitions[index] = tmp;
}
);
if (!orphanCollections) {
orphanCollections = [];
}
@ -2089,6 +2116,7 @@ var Graph = function(graphName, edgeDefinitions, vertexCollections, edgeCollecti
createHiddenProperty(this, "__idsToRemove", []);
createHiddenProperty(this, "__collectionsToLock", []);
createHiddenProperty(this, "__orphanCollections", orphanCollections);
require("internal").print("preBind");
updateBindCollections(self);
};
@ -2198,7 +2226,7 @@ var checkIfMayBeDropped = function(colName, graphName, graphs) {
////////////////////////////////////////////////////////////////////////////////
/// @startDocuBlock JSF_general_graph_drop
/// `general-graph._drop(graphName, dropCollections)`
/// `graph_module._drop(graphName, dropCollections)`
/// *Remove a graph*
///
/// A graph can be dropped by its name.
@ -2213,13 +2241,29 @@ var checkIfMayBeDropped = function(colName, graphName, graphs) {
///
/// *Examples*
///
/// Drop a graph:
/// Drop a graph and keep collections:
///
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphDropGraph}
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphDropGraphKeep}
/// ~ var examples = require("org/arangodb/graph-examples/example-graph.js");
/// ~ var g1 = examples.loadGraph("social");
/// var graph = require("org/arangodb/general-graph");
/// graph._drop("social");
/// db._collection("female");
/// db._collection("male");
/// db._collection("relation");
/// ~ db._drop("female");
/// ~ db._drop("male");
/// ~ db._drop("relation");
/// @END_EXAMPLE_ARANGOSH_OUTPUT
///
/// @EXAMPLE_ARANGOSH_OUTPUT{generalGraphDropGraphDropCollections}
/// ~ var examples = require("org/arangodb/graph-examples/example-graph.js");
/// ~ var g1 = examples.loadGraph("social");
/// var graph = require("org/arangodb/general-graph");
/// graph._drop("social", true);
/// db._collection("female");
/// db._collection("male");
/// db._collection("relation");
/// @END_EXAMPLE_ARANGOSH_OUTPUT
///
/// @endDocuBlock
@ -2711,7 +2755,7 @@ Graph.prototype._commonNeighbors = function(vertex1Example, vertex2Example, opti
/// `graph._countCommonNeighbors(vertex1Example, vertex2Examples, optionsVertex1, optionsVertex2)`
/// *Get the amount of common neighbors of the vertices defined by the examples.*
///
/// Similar to (_commonNeighbors)[#_commonNeighbors] but returns count instead of the elements.
/// Similar to [_commonNeighbors](#_commonNeighbors) but returns count instead of the elements.
///
/// *Examples*
///
@ -3442,8 +3486,6 @@ Graph.prototype._diameter = function(options) {
};
////////////////////////////////////////////////////////////////////////////////
/// @startDocuBlock JSF_general_graph__extendEdgeDefinitions
/// `graph._extendEdgeDefinitions(edgeDefinition)`
@ -3475,6 +3517,7 @@ Graph.prototype._diameter = function(options) {
////////////////////////////////////////////////////////////////////////////////
Graph.prototype._extendEdgeDefinitions = function(edgeDefinition) {
edgeDefinition = sortEdgeDefinition(edgeDefinition);
var self = this;
var err;
//check if edgeCollection not already used
@ -3541,7 +3584,6 @@ Graph.prototype._extendEdgeDefinitions = function(edgeDefinition) {
}
);
updateBindCollections(this);
};
////////////////////////////////////////////////////////////////////////////////
@ -3636,7 +3678,7 @@ var changeEdgeDefinitionsForGraph = function(graph, edgeDefinition, newCollectio
///
////////////////////////////////////////////////////////////////////////////////
Graph.prototype._editEdgeDefinitions = function(edgeDefinition) {
edgeDefinition = sortEdgeDefinition(edgeDefinition);
var self = this;
//check, if in graphs edge definition
@ -3652,7 +3694,7 @@ Graph.prototype._editEdgeDefinitions = function(edgeDefinition) {
//evaluate collections to add to orphanage
var possibleOrphans = [];
var currentEdgeDefinition;
this.__edgeDefinitions.forEach(
this.__edgeDefinitions.forEach(
function(ed) {
if (edgeDefinition.collection === ed.collection) {
currentEdgeDefinition = ed;

View File

@ -32,9 +32,11 @@ module.define("org/arangodb/graph", function(exports, module) {
var gp = require("org/arangodb/graph-blueprint");
require("console").warn('module "graph" is deprecated, please use ' +
'module "general-graph" instead');
// The warning will be activated soon.
/*
* require("console").warn('module "graph" is deprecated, please use ' +
* 'module "general-graph" instead');
*/
Object.keys(gp).forEach(function (m) {
exports[m] = gp[m];

View File

@ -1790,7 +1790,6 @@ var bindEdgeCollections = function(self, edgeCollections) {
var bindVertexCollections = function(self, vertexCollections) {
_.each(vertexCollections, function(key) {
require("internal").print("each resolved");
var obj = db._collection(key);
var result;
var wrap = wrapCollection(obj);
@ -1888,6 +1887,15 @@ var updateBindCollections = function(graph) {
bindVertexCollections(graph, graph.__orphanCollections);
};
////////////////////////////////////////////////////////////////////////////////
/// internal helper to sort a graph's edge definitions
////////////////////////////////////////////////////////////////////////////////
var sortEdgeDefinition = function(edgeDefinition) {
edgeDefinition.from = edgeDefinition.from.sort();
edgeDefinition.to = edgeDefinition.to.sort();
return edgeDefinition;
};
////////////////////////////////////////////////////////////////////////////////
/// @startDocuBlock JSF_general_graph_vertex_collection_save
/// `graph.vertexCollectionName.save(data)`
@ -2087,6 +2095,13 @@ var updateBindCollections = function(graph) {
///
////////////////////////////////////////////////////////////////////////////////
var Graph = function(graphName, edgeDefinitions, vertexCollections, edgeCollections, orphanCollections) {
edgeDefinitions.forEach(
function(eD, index) {
var tmp = sortEdgeDefinition(eD);
edgeDefinitions[index] = tmp;
}
);
if (!orphanCollections) {
orphanCollections = [];
}
@ -3469,8 +3484,6 @@ Graph.prototype._diameter = function(options) {
};
////////////////////////////////////////////////////////////////////////////////
/// @startDocuBlock JSF_general_graph__extendEdgeDefinitions
/// `graph._extendEdgeDefinitions(edgeDefinition)`
@ -3502,6 +3515,7 @@ Graph.prototype._diameter = function(options) {
////////////////////////////////////////////////////////////////////////////////
Graph.prototype._extendEdgeDefinitions = function(edgeDefinition) {
edgeDefinition = sortEdgeDefinition(edgeDefinition);
var self = this;
var err;
//check if edgeCollection not already used
@ -3568,7 +3582,6 @@ Graph.prototype._extendEdgeDefinitions = function(edgeDefinition) {
}
);
updateBindCollections(this);
};
////////////////////////////////////////////////////////////////////////////////
@ -3663,7 +3676,7 @@ var changeEdgeDefinitionsForGraph = function(graph, edgeDefinition, newCollectio
///
////////////////////////////////////////////////////////////////////////////////
Graph.prototype._editEdgeDefinitions = function(edgeDefinition) {
edgeDefinition = sortEdgeDefinition(edgeDefinition);
var self = this;
//check, if in graphs edge definition

View File

@ -31,9 +31,11 @@
var gp = require("org/arangodb/graph-blueprint");
require("console").warn('module "graph" is deprecated, please use ' +
'module "general-graph" instead');
// The warning will be activated soon.
/*
* require("console").warn('module "graph" is deprecated, please use ' +
* 'module "general-graph" instead');
*/
Object.keys(gp).forEach(function (m) {
exports[m] = gp[m];

View File

@ -164,6 +164,20 @@ function GeneralGraphCreationSuite() {
}
},
test_collectionSorting: function() {
var g = graph._create(
gn,
graph._edgeDefinitions(
graph._directedRelation(rn1, [vn2, vn1], [vn4, vn3])
)
);
assertEqual([vn1, vn2], g.__edgeDefinitions[0].from);
assertEqual([vn3, vn4], g.__edgeDefinitions[0].to);
},
test_directedRelation : function () {
var r = graph._directedRelation(rn,
[vn1, vn2], [vn3, vn4]);
@ -563,11 +577,34 @@ function GeneralGraphCreationSuite() {
assertEqual([dr1], g1.__edgeDefinitions);
g1._addVertexCollection(vc3);
assertEqual([vc3], g1._orphanCollections());
g1._extendEdgeDefinitions(dr3);
assertEqual([dr1, dr3], g1.__edgeDefinitions);
assertEqual([], g1._orphanCollections());
g1._extendEdgeDefinitions(dr2);
assertEqual([dr1, dr3, dr2], g1.__edgeDefinitions);
},
test_extendEdgeDefinitionFromExistingGraph4: function() {
try {
graph._drop(gN1, true);
} catch(ignore) {
}
try {
graph._drop(gN2, true);
} catch(ignore) {
}
var dr1 = graph._directedRelation(ec1, [vc1], [vc1, vc2]),
dr2 = graph._directedRelation(ec2, [vc4, vc3, vc1, vc2], [vc4, vc3, vc1, vc2]),
g1 = graph._create(gN1, [dr1]);
g1._extendEdgeDefinitions(dr2);
assertEqual([dr1, dr2], g1.__edgeDefinitions);
assertEqual([], g1._orphanCollections());
g1._extendEdgeDefinitions(dr3);
assertEqual([dr1, dr2, dr3], g1.__edgeDefinitions);
var edgeDefinition = _.findWhere(g1.__edgeDefinitions, {collection: ec2});
assertEqual(edgeDefinition.from, [vc1, vc2, vc3, vc4]);
assertEqual(edgeDefinition.to, [vc1, vc2, vc3, vc4]);
},
@ -1188,7 +1225,7 @@ function ChainedFluentAQLResultsSuite() {
assertEqual(stmt, plainVertexQueryStmt(0));
assertEqual(query.bindVars.vertexExample_0, [
{name: uaName},
{name: p1Name},
{name: p1Name}
]);
assertEqual(query.bindVars.options_0, {});
},
@ -1219,7 +1256,7 @@ function ChainedFluentAQLResultsSuite() {
assertEqual(query.bindVars.vertexExample_0, [
{name: uaName},
{_id: b_id},
{name: ucName},
{name: ucName}
]);
assertEqual(query.bindVars.options_0, {});
},

View File

@ -7063,17 +7063,17 @@ exports.GEO_WITHIN = GEO_WITHIN;
exports.FULLTEXT = FULLTEXT;
exports.GRAPH_PATHS = GRAPH_PATHS;
exports.GRAPH_SHORTEST_PATH = GRAPH_SHORTEST_PATH;
exports.GENERAL_GRAPH_SHORTEST_PATH = GENERAL_GRAPH_SHORTEST_PATH;
exports.GENERAL_GRAPH_DISTANCE_TO = GENERAL_GRAPH_DISTANCE_TO;
exports.GRAPH_TRAVERSAL = GRAPH_TRAVERSAL;
exports.GRAPH_TRAVERSAL_TREE = GRAPH_TRAVERSAL_TREE;
exports.GRAPH_EDGES = GRAPH_EDGES;
exports.GRAPH_NEIGHBORS = GRAPH_NEIGHBORS;
exports.GENERAL_GRAPH_TRAVERSAL = GENERAL_GRAPH_TRAVERSAL;
exports.GENERAL_GRAPH_TRAVERSAL_TREE = GENERAL_GRAPH_TRAVERSAL_TREE;
exports.GRAPH_EDGES = GRAPH_EDGES;
exports.GENERAL_GRAPH_EDGES = GENERAL_GRAPH_EDGES;
exports.GENERAL_GRAPH_VERTICES = GENERAL_GRAPH_VERTICES;
exports.GENERAL_GRAPH_PATHS = GENERAL_GRAPH_PATHS;
exports.GRAPH_NEIGHBORS = GRAPH_NEIGHBORS;
exports.GENERAL_GRAPH_SHORTEST_PATH = GENERAL_GRAPH_SHORTEST_PATH;
exports.GENERAL_GRAPH_DISTANCE_TO = GENERAL_GRAPH_DISTANCE_TO;
exports.GENERAL_GRAPH_NEIGHBORS = GENERAL_GRAPH_NEIGHBORS;
exports.GENERAL_GRAPH_COMMON_NEIGHBORS = GENERAL_GRAPH_COMMON_NEIGHBORS;
exports.GENERAL_GRAPH_COMMON_PROPERTIES = GENERAL_GRAPH_COMMON_PROPERTIES;