You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I noticed a problem where item_frequencies unexpectedly returns {None: 1}.
Here's my repro:
import mongoengine as me
import settings
me.connect('test', host=settings.MONGO_URL)
# Define a document type with a list field
class TestDocument(me.Document):
id = me.SequenceField(primary_key=True)
fruit = me.ListField(me.StringField())
# Insert one document that has a non-empty list
doc1 = TestDocument()
doc1.fruit = ['apple', 'orange']
doc1.save()
# Get the item_frequencies
item_frequencies = TestDocument.objects().item_frequencies('fruit')
print item_frequencies
# Change the document. Make it an empty list.
doc1.fruit = []
doc1.save()
# Get the item_frequencies again
item_frequencies = TestDocument.objects().item_frequencies('fruit')
print item_frequencies
Note that if the list starts out as empty then the problem doesn't repro. It only repros if the document first has a non-empty list and then has that list cleared out.
The text was updated successfully, but these errors were encountered:
I noticed a problem where item_frequencies unexpectedly returns {None: 1}.
Here's my repro:
Here's the output:
Note that if the list starts out as empty then the problem doesn't repro. It only repros if the document first has a non-empty list and then has that list cleared out.
The text was updated successfully, but these errors were encountered: