pythonarangodbpyarango

ArangoDB - Collection not found error though the collection is created


I am creating an edge "has_taken" between two documents as follows:

sin_graph.createEdge("has_taken", userDoc._id, tripDoc._id, edgeAttributes={})

And I am getting the following error:

File "/Library/Python/2.7/site-packages/pyArango/graph.py", line 135, in createEdge raise CreationError("Unable to create edge, %s" % r.json()["errorMessage"], data) CreationError: Unable to create edge, collection not found. Errors: {u'code': 404, u'errorNum': 1203, u'errorMessage': u'collection not found', u'error': True}

The collection with the name "has_taken" is present and yet I am getting the above error.


Solution

  • I think it may be because you made a collection of type Collection and not of type Edge (haha, confusing, I know.)

    But when making the collection called "has_taken", instead of

    db.createCollection(className="Collection", name="has_taken")
    

    try

    db.createCollection(className="Edges", name="has_taken")
    

    I noticed that when I was reading this page. (Look at the very top of your screen when you click that link. The function and its description is right up there and it mentions this difference.)

    createCollection(className='Collection', waitForSync=False, **colArgs)[source]
    

    Creates a collection and returns it. ClassName the name of a class inheriting from Collection or Egdes, it can also be set to ‘Collection’ or ‘Edges’ in order to create untyped collections of documents or edges.