[JAVA-1314] Create Jackson-based implementation of Codec Created: 21/Jul/14  Updated: 25/Jan/18  Resolved: 25/Jan/18

Status: Closed
Project: Java Driver
Component/s: Codecs
Affects Version/s: None
Fix Version/s: None

Type: New Feature Priority: Major - P3
Reporter: Jeffrey Yemin Assignee: Unassigned
Resolution: Duplicate Votes: 9
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates JAVA-2483 Add support for Jackson Java JSON ser... Backlog
Related

 Description   

Create a Codec implementation on top of the Jackson JSON library as proof that the abstraction is correct and so that there is at least one functional POJO codec that people can use with the 3.0 driver's generic collection API.



 Comments   
Comment by Jeffrey Yemin [ 25/Jan/18 ]

Closing as duplicate of JAVA-2483

Comment by Ralph Jennings [ 04/Apr/17 ]

@aleksey, Yes, and now that the jackson-compatible JSON.serialize method has been deprecated, we are left with a hole here. Please release this library soon.

Comment by Aleksey Korolev [ 11/Nov/16 ]

Not having this available push people to using straightforward approach: get Document from MongoCollection, serialize it to JSON string and feed that string to Jackson to obtain their Jackson annotated POJO. Voting for making Jackson codec publicly available.

Comment by Gastmeier [X] [ 11/Jul/15 ]

I am interested to take a look. Do you think that the test cases are exhausting?

Comment by Yann Le Moigne [ 10/Jul/15 ]

Hi.

No sorry. I did not took the time to investigate further why tests are failing. I won't have much time in the next weeks :s.
I can share the branch if someone is interested to take a look.

Comment by Jeffrey Yemin [ 10/Jul/15 ]

I have not yet. Any update from you, ylemoigne?

Comment by Gastmeier [X] [ 10/Jul/15 ]

Anything new on this topic? Did you create a seperate repository? Is there a solution with zero byte array copies available?

Comment by Jeffrey Yemin [ 27/Apr/15 ]

The extraction would be to benefit the whole community. We will consider maintaining this ourselves, even if in a separate repository.

Comment by Yann Le Moigne [ 27/Apr/15 ]

Yes I saw, minor glitch in one file.

Don’t worry to extract pull request in another repository, I’ve already fetched the files. I’ve fixed the compilation problem, but now, most of tests case are in failure, I’ll take a deeper look next week end.

Comment by Jeffrey Yemin [ 27/Apr/15 ]

It's going to take a little more work than I thought. That pull request doesn't compile, and after fixing the compilation error there are failing tests.

Comment by Jeffrey Yemin [ 26/Apr/15 ]

Sounds great. I'll pull this this PR out into a separate repository so that it can forked.

Comment by Yann Le Moigne [ 26/Apr/15 ]

Hi Jeff,

Thanks for pointing me to this PR, I've taken a very quick look, I think I'll take it as a base to drop bson4jackson.

I perfectly understand that you don't want to take jackson dependency in mongo-java-driver and it's a good separation of concern to get jackson codec in another repo.

I think that there is a lot of interest for a Jackson codec. It's a common usecase in java word to have a REST API consuming and producing json, and Jackson is the most used (de)serializer. As a developper, I don't want to have many mapping definition nor many JSON technologies. And I don't want to write boilerplate code to convert one representation from/to the other.

Comment by Jeffrey Yemin [ 26/Apr/15 ]

Hi Yann,

Thanks for posting your POC. I neglected to note on the ticket that there is already an outstanding pull request for this: https://github.com/mongodb/mongo-java-driver/pull/238. We ended up parking it so as not to take a Jackson dependency for the project as a whole. We would consider publishing it in a separate repo if there is interest.

The approach in this pull request is a bit different than the one you took. In order to avoid the extra byte array copies that are necessary when using bson4jackson and RawBsonDocumentCodec, it implements its own Jackson codec directly on top of BsonReader and BsonWriter.

Please have a look and let us know what you think.

Regards
Jeff

Comment by Yann Le Moigne [ 26/Apr/15 ]

I made a POC here : https://github.com/ylemoigne/mongo-jackson-codec

Generated at Thu Feb 08 08:54:18 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.