简体   繁体   中英

Creating unique index in pyarango arangodb

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?

您需要在列表中提供字段,因此请尝试以下操作:

db['Users'].ensureHashIndex(['word'], unique = True)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM