-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MongoDB: error while impersonating user #223
Comments
MongoDB object IDs are 12 bytes and will not fit into an 8 byte integer. Problem is in gluon/tools.py at line 2081: db.define_table(
settings.table_permission_name,
Field('group_id', reference_table_group,
label=self.messages.label_group_id),
Field('name', default='default', length=512,
label=self.messages.label_name,
requires=is_not_empty),
Field('table_name', length=512,
label=self.messages.label_table_name),
Field('record_id', 'integer', default=0, # field type is wrong for MongoDB
label=self.messages.label_record_id,
requires=IS_INT_IN_RANGE(0, 10 ** 9)), Specifically 'record_id' type should likely be 'id' not 'integer'. Also the requires clause will need a wider range. Changing this field to 'id' fixes the problem in my tests on Mongo, but I have no easy way to know how it would impact other databases. I don't how or if this bug can be moved over to web2py. |
I think this is web2py related and not pydal. @mdipierro ? |
@stephenrauch switching the type to 'id' is not feasible for all adapters. For example on postgres the type 'id' is converted into a |
@ilvalle ok, but still I think is web2py related and not pydal related. |
Being new to pydal, let me see if I understand the design:
'record_id' in the above use case isn't a primary key, so that means it is a foreign key. Unless bullet 3 above is a thing, it is definitely a web2py issue and the field type should be changed to "reference Field('record_id', 'reference permission', default=0, |
@stephenrauch the change to |
We have to make a decision here: 1 is easier but I think 3 would be best. |
@mdipierro solution 3 sounds interesting but can also be quite confusing for users. |
My understanding is that pydal currently has:
Proposal for solution 3 is: Questions: |
I have this
that produces this error:
<type 'exceptions.OverflowError'> MongoDB can only handle up to 8-byte ints
Version
Traceback
It was working well on the previous version
The text was updated successfully, but these errors were encountered: