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

Add support of "bson.dbref.DBRef" data type for formatting value. The… #692

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

burnettzhong
Copy link

… "bson.dbref.DBRef" is used by Solr DBRef.

@@ -96,6 +96,8 @@ def transform_value(self, value):
return value
elif isinstance(value, datetime.datetime):
return value
elif isinstance(value, bson.dbref.DBRef):
return value.id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the DBRef.database and DBRef.collection?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, you are correct, this change does not cover database and collection value, but only the id value.
At least, it supports DBRef data from MongoDB, and it can be used by complex search like "join" in Solr.
In order to cover database and collection value, we need to modify function transform_element and format_document which I'm working on it.

README.rst Outdated
-----------
Add support to DBRef whose datatype is "bson.dbref.DBRef".


Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will remove this.

@burnettzhong
Copy link
Author

burnettzhong commented Apr 3, 2017

I have updated it to cover all database, collection and id data. It works perfect in my local environment.
I am not good at Python, sorry if my code is repeating. I am very glad if someone can refine it.

@burnettzhong
Copy link
Author

BTW, have no idea why the CI is failed for MongoDB 2.4.14

@KamalHr
Copy link

KamalHr commented May 30, 2018

Does this work fine with elasticsearch?

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

Successfully merging this pull request may close these issues.

3 participants