Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Metadata creation MongoDB error #64

Open
Nelgamix opened this issue May 27, 2016 · 4 comments
Open

Metadata creation MongoDB error #64

Nelgamix opened this issue May 27, 2016 · 4 comments

Comments

@Nelgamix
Copy link

Nelgamix commented May 27, 2016

Hello,
I have an issue when it comes to create new metadata.
I ran all the basics step for a fresh install, and tried to create metadata with this python script:

from camomile import Camomile
import sys

print(' Connecting...')
client = Camomile('http://localhost:3000')
print(' Logging in...')
client.login('root', 'admin')

# We seek the corpus or we create it
cprs = client.getCorpora(name='poiuytreza')
if len(cprs) == 0:  # If we didn't find it, we need to create it
    cprs = client.createCorpus('test')
else:  # Otherwise, we create it here
    cprs = cprs[0]

# We try to add metadata
try:
    client.setCorpusMetadata(cprs._id, path="mymtdata", datas={'gt': 'dzq'})
except Exception as e:
    print('Erreur: ' + str(e))
    sys.exit(-1)

print(' Logging out...')
client.logout()  # Logout of the camomile server

But it seems that the server is throwing an error:

python test.py ../camomile_data/media
 Connecting...
 Logging in...
Erreur: 400 Camomile Client Error: {u'message': u'E11000 duplicate key error collection: camomile.metadatas index: path_1 dup key: { : "," }', u'code': 11000, u'ok': 0, u'name': u'MongoError', u'errmsg': u'E11000 duplicate key error collection: camomile.metadatas index: path_1 dup key: { : "," }'}

I tried with the JS client too, and the same error happens.
The python client is up to date (v0.8)

When I investigated the code, I found that it's maybe because this.constructTreeSchema(metadata, upload_dir, undefined, undefined, modelName, resource); is not doing its job and the tree tries to recreate root paths that already exist...

Could you please look into that and tell me what you think about it? Maybe i'm just doing something wrong here, and if that's the case, I think the documentation is either not up to date or incomplete.

Thanks

@hbredin
Copy link
Member

hbredin commented May 27, 2016

Documentation is not up to date. It should actually be used like that:

client.setCorpusMetadata(cprs._id, {'gt': 'dzq'}, path="mymtdata")

That being said, I think you did discover a bug in the server. Will look into it.

cc'ing @marc-j just in case you have an idea of what might happen here...

@Nelgamix
Copy link
Author

After a full cleanup of the system and of docker images, it seems that it works again, that was maybe due to a bad database clean up. Sorry for that.
I tried just now and it seems that the problem is gone.
Thanks

@hbredin
Copy link
Member

hbredin commented May 27, 2016

I'd rather leave this issue open until we are really sure the bug is fixed.
There might actually be a problem... But I am glad your problem is gone :)

@hbredin hbredin reopened this May 27, 2016
@Nelgamix
Copy link
Author

There was a problem, and I don't understand why it's fixed now (with the cleanup), because when I tested with each time a new corpus (before the full cleanup), this problem occured. But again, I just tried several times, maybe it's not fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants