Unable to Access Renamed Column 'woocomerce_id' in MongoEngine
kmikodev opened this issue · 1 comments
kmikodev commented
Steps to Reproduce:
- Update the column name from 'ID' to 'woocomerce_id' in the 'Orders' collection using pymongo.
- Verify that all documents now have the 'woocomerce_id' property in the database.
- Use MongoEngine to retrieve and access the 'woocomerce_id' property from the 'Orders' collection.
- Observe the error message: "'Orders' object has no attribute 'woocomerce_id'".
Expected Behavior:
The attribute 'woocomerce_id' should be accessible using the MongoEngine model 'Orders'.
Actual Behavior:
Attempting to access 'woocomerce_id' using the MongoEngine model 'Orders' results in the mentioned error.
Additional Information:
- I have verified that the model 'Orders' in MongoEngine has been updated to reflect the column name change.
- The pymongo implementation works correctly, and I can access the 'woocomerce_id' property using pymongo.
- When accessing the 'woocomerce_id' property using pymongo, the field is accessible without any issues.
- Restarting the application did not resolve the issue.
- Other attributes of the 'Orders' model can be accessed without any problems.
Environment:
- Python version: 3.2
- MongoEngine version: 0.27.0
- pymongo version: 4.4.1
- Operating System: Ubuntu 22.04
Code Snippets:
# Model definition in MongoEngine
class Orders(Document):
woocomerce_id = StringField()
# Other fields
# Accessing the property in the application
order_mongoengine = Orders.objects(id=id).first()
woocomerce_id_value = order_mongoengine.woocomerce_id # This line triggers the error
bagerard commented