Closed davidegraff closed 2 years ago
This is because I was working on a feature for compound searching and there is a mismatch between the structure and database, Sorry about not notifying. You can replace the current compounds object with the following:
class Compounds(me.Document):
inchikey = me.StringField(required=True, primary_key=True)
name = me.StringField(default="")
smiles = me.StringField(required=True, validation=validate_smiles)
inchi = me.StringField(required=True)
cid = me.StringField(default="")
iupac = me.StringField(default="")
synonyms = me.ListField(me.StringField(), default = [])
modified = me.DateTimeField(default=datetime.datetime.utcnow)
should probably delete the default=[]
in the PR that addresses this because default arguments as mutable objects can lead to problems. The default is also already an empty list
I deleted it from my end
Summary
Trying to iterate through the
compounds
collection in our MongoDB using theCompounds
document failsBackground
using mongoengine, you can iterate through documents in your database like so:
The above code block would iterate through the
user
collection in your MongoDB, seamlessly parsing all of the documents into the correspondingUser
document in the client codebase.Expected behavior
Observed behavior:
Cause
The offending source is here. Our
Compounds
document has nosynonyms
field, but the documents in our backend DB do. We must either delete this field from each document, or update theCompounds
document accordingly.