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

Dynamic collection name #8

Closed
ChristoRibeiro opened this issue Jul 24, 2014 · 6 comments
Closed

Dynamic collection name #8

ChristoRibeiro opened this issue Jul 24, 2014 · 6 comments

Comments

@ChristoRibeiro
Copy link

Hi Fehmi,

There is a way to change the collection name dynamically with the JsonDao and work with JsObject (without case class)? I'm working with several collection dynamically, each one can be created or removed on the fly.

For example:

object DataStore extends JsonDao[JsObject, BSONObjectID](Mongo.db)

DataStore.collection("myCollection1").find()
DataStore.collection("myCollection2").find()

// or more easy

DataStore("myColleciton1").find()
DataStore("myColleciton2").find()

No case class, just an easy way to access on different collection with the magic power of reactivemongo extensions :)

@fehmicansaglam
Copy link
Owner

I haven't tried but JsObject should work as is.

Currently there is no way of specifying the collection name dynamically. I have also been thinking of it. Give me 2 or 3 days time or submit a PR :)

@ChristoRibeiro
Copy link
Author

I can look for a PR, but maybe you'll be more faster than me.

Anyway, I think the above way could be very interesting for many people.

@fehmicansaglam
Copy link
Owner

Agreed. Expect a snapshot release soon.

@ChristoRibeiro ChristoRibeiro changed the title Collection name dynamic Dynamic collection name Jul 24, 2014
@fehmicansaglam
Copy link
Owner

I have released a new snapshot: 0.10.0.5-SNAPSHOT. There is no documentation yet. Can you review the test code and comment on usability? https://github.com/fehmicansaglam/reactivemongo-extensions/blob/0.10.x/json/src/test/scala/dao/DynamicJsonDaoSpec.scala

@ChristoRibeiro
Copy link
Author

Looks like a natural extension of existing features 👍

I did some tests and everything seems to work

@fehmicansaglam
Copy link
Owner

Cool! We are also releasing a snapshot from ReactiveMongo organization today.

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

2 participants