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

ReactiveMongo 0.20.1 bson lib #94

Open
arch89 opened this issue Jan 17, 2020 · 6 comments
Open

ReactiveMongo 0.20.1 bson lib #94

arch89 opened this issue Jan 17, 2020 · 6 comments

Comments

@arch89
Copy link
Contributor

arch89 commented Jan 17, 2020

if I am not mistaken, reactivemongo.api.bson should be used instead of reactivemongo.bson

@arch89
Copy link
Contributor Author

arch89 commented Jan 17, 2020

i have created #95
BSONDBPointer was deprecated

@DenisNovac
Copy link

PR was not merged yet so i found some workaround. Maybe it'll help someone.

There is an compatibility layer reactivemongo-bson-compat. I use it like this:

import reactivemongo.api.bson.{BSONDocument, BSONDocumentReader, BSONObjectID}

/** Circe encoders based converter from BSON to Document */
implicit object DocumentReader extends BSONDocumentReader[Document] with BsonCodecInstances {
  
  override def readDocument(doc: BSONDocument): Try[Document] = {
    import reactivemongo.api.bson.compat._ // implicit conversions
    for {
      json <- bsonToJson(doc)
      doc  <- json.as[Document]
    } yield doc
  }.toTry
}

@xBATx
Copy link

xBATx commented Nov 12, 2020

Thanks @DenisNovac it helped at least to me.

Guys when do you plan to release those changes?

The https://github.com/ReactiveMongo/ReactiveMongo-BSON is already released to 1.0.0 and with that version, neither workaround above is working due to classpath issues. - They released only reactivemongo package, the latest of reactivemongo-bson-compat is 0.20.13 so I'm not sure they plan to support this in the future.

@travisbrown
Copy link
Member

0.5.0 is on its way to Maven Central: https://github.com/circe/circe-bson/releases/tag/v0.5.0

@xBATx
Copy link

xBATx commented Nov 12, 2020

Great thx, I'm glad to hear that. :)

@DenisNovac
Copy link

It seems to work good with reactivemongo 1.0.3, thanks

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

No branches or pull requests

4 participants