0

I used the mongoDB method update to modify existing documents in a collection named annotations. My command, written in a Python script, is:

db['annotations'].update({'_id': annotation['_id']}, {'$set': {'orthologs': orthologs}}, False)

The field orthologs must be modify to contain a new subfield UniProt that is given by the variable named orthologs.

Surprisingly, a new collection was created with the name annotations_keys. It contains only one document : { "_id" : "UniProt", "value" : null }.

Is it normal? If not, what is the problem?

fredtantini
  • 15,966
  • 8
  • 49
  • 55
ldespons
  • 1
  • 1

1 Answers1

0

Yes Rafael, I'm sure.

The new created collection is really named 'annotationS'+'_keys' like the initial collection 'annotationS'. In addition, annotation['_id'] comes from a loop that finds in the db each document ('annotation') corresponding to the request:

annotation = db['annotations'].find_one({'class': 'CDS', 'locus_tag': annotated_molecule.name})
ldespons
  • 1
  • 1