I've been confused with this error. I'm creating a Vehicle database with mongoengine that goes like this.
class Vehicles(Document):
make: StringField()
model: StringField()
license: StringField()
year: IntField()
mileage: IntField()
deleted: BooleanField()
for j in range(2):
vehicle = Vehicles(
make="Honda",
model="Civic",
license="H54 " + str(i) + str(j),
year=2015,
mileage= 500 + (i * 500),
deleted=False
).save()
While I try running the code, I've been getting:
mongoengine.errors.FieldDoesNotExist: The fields "{'license', 'year', 'model', 'mileage', 'make', 'deleted'}" do not exist on the document "Vehicles"
I don't understand why it's giving me this error. I know a solution is to change Document into DynamicDocument, but I don't really see why. Can someone please explain to me this error???