Skip to content
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

issue with Frame.by_id #6

Closed
njordr opened this issue Jul 12, 2016 · 3 comments
Closed

issue with Frame.by_id #6

njordr opened this issue Jul 12, 2016 · 3 comments
Labels

Comments

@njordr
Copy link

njordr commented Jul 12, 2016

Hi.

I've this document:
{
"_id" : "report_xyz",
"name" : "XYZ.COM",
"site24" : {
"monitors" : [
NumberLong(27498547952905495),
NumberLong(18975984759794899),
NumberLong(19875894954998994),
NumberLong(14987598437950899),
NumberLong(17498574975919809)
]
}
}

If I try to get it with by_id this is the error:
bson.errors.InvalidId: 'report_xyz' is not a valid ObjectId, it must be a 12-byte input or a 24-character hex string

Giovanni

@anthonyjb
Copy link
Member

Hi @njordr - yep this is a bug :) I incorrectly assumed that _ids will always be ObjectIds and automatically convert whatever value is passed to one, which I don't need to do - I'll fix today and push a new release to pip.

In the short-term (e.g before I fix this) you can use the following as a work around:

my_frame = MyFrame.one(Q._id == 'report_xyz')

@anthonyjb anthonyjb added the bug label Jul 12, 2016
@njordr
Copy link
Author

njordr commented Jul 12, 2016

Already done, thanks for the advice

@anthonyjb
Copy link
Member

OK @njordr that should be resolved and the new release (1.0.3) is now up on PyPi :)

Thanks for your help so far it's been very useful to have someone using the library and providing feedback.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants