2

I am trying to add an unique index to my collection. I am writing code:

conn = Connection()
db = conn['textBook']
db['Users'].ensureHashIndex('word', unique = True);

(There is database 'textBook' with collection 'Users' existing.)

pyArango.theExceptions.CreationError: bad parameter. Errors: {u'errorMessage': u'bad parameter', u'errorNum': 10, u'code': 400, u'error': True}

It is occuring while creating Index in function _create (raise CreationError(data['errorMessage'], data) )

Which parameters are incorrect?

1
  • 1
    A hot guess would be that you need to specify the fields the index is created on as you need to in js: docs.arangodb.com/IndexHandling/Hash.html - this most probably maps to python like this: {fields: [ "word"]}; depending on the implementation only adding brackets [ ] to get a list may work. Commented May 17, 2016 at 8:27

1 Answer 1

5

You need to provide fields in a list, so try this:

db['Users'].ensureHashIndex(['word'], unique = True)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.