-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
mongoengine.errors.ValidationError: A ReferenceField only accepts DBRef or documents #997
Comments
Not really, but this doesn't sound good... There is quite a bit to do here, but if I have time, I may inspect that further. Else, feel free to submit a PR, at least with a proper (failing) test, even better with the fix :-) |
I had a similar problem and apparently it occurs when the In my case, inside the
Hope this helps. |
try using |
@rahulrameshan you are right, thank you. |
Mongoengine version: 0.23.1 This one returns an ObjectId
In case you already have the guard ID, you don't need to retrieve the instance from the DB, you could just do:
|
python 2.7.8, latest mongoengine.zip from master:
mongoengine/fields.py, line 990
first "if" gives the following code
mongoengine.errors.ValidationError: A ReferenceField only accepts DBRef or documents
traceback:
https://gist.github.com/saritasa/27d82f33e3cc33afe1cb
If I run it again - everything works. If I uncomment the first guard and comment 2nd guard, I get this error again. Run 4th time - and error gone.
value is ObjectId type, when I debug code.
Sample data:
Full shift class is here:
https://gist.github.com/saritasa/ad9387a1259141db4a04
any ideas?
The text was updated successfully, but these errors were encountered: