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

Support collation for MongoDB 3.4+ #630

Open
cchantep opened this issue Feb 8, 2017 · 14 comments
Open

Support collation for MongoDB 3.4+ #630

cchantep opened this issue Feb 8, 2017 · 14 comments

Comments

@cchantep
Copy link
Member

cchantep commented Feb 8, 2017

No description provided.

@cchantep cchantep added this to the 1.0 milestone Feb 8, 2017
@seyuf
Copy link

seyuf commented Feb 23, 2017

👍 for the collation!

@cchantep cchantep changed the title Support collaction for MongoDB 3.4+ Support collation for MongoDB 3.4+ Feb 23, 2017
@st3ffan
Copy link

st3ffan commented Aug 1, 2017

Hello @cchantep - Is collation a work in progress / is anyone working on this right now? I'd like to assist if possible

@cchantep
Copy link
Member Author

cchantep commented Aug 1, 2017

No WIP

@abdvel
Copy link

abdvel commented Jun 7, 2018

Why?

@cchantep
Copy link
Member Author

cchantep commented Jun 7, 2018

... Because it need to be develop, but nothing ongoing

@lglossman-ring
Copy link

@cchantep I see that on 0.16, collation has been added, but at least when using it with 'unique', it doesn't seem to make any effect. Is it really implemented?

@cchantep
Copy link
Member Author

If this is still open, there is still work to be done.

@cchantep cchantep removed this from the 1.0 milestone May 30, 2020
@Marcnuth
Copy link

Marcnuth commented Jun 5, 2020

any updates or plan on this?

@cchantep
Copy link
Member Author

cchantep commented Jun 5, 2020

any updates or plan on this?

Partial support. Be more specific if you expect something.

@JasonRoyChen
Copy link

JasonRoyChen commented Jun 5, 2020

any updates or plan on this?

Partial support. Be more specific if you expect something.

@cchantep Hi there, I need to use collation in find query to let query result sorted as case insensitive. Is this function already set up?

@cchantep
Copy link
Member Author

cchantep commented Jun 5, 2020

any updates or plan on this?

Partial support. Be more specific if you expect something.

@cchantep Hi there, I need to use collation in find query to let query result sorted as case insensitive. Is this function already set up?

http://reactivemongo.org/releases/0.1x/api/reactivemongo/api/collections/GenericQueryBuilder.html#collation(collation:reactivemongo.api.Collation):GenericQueryBuilder.this.Self

@seyuf
Copy link

seyuf commented Oct 24, 2020

Hi,
hope this will help someone, it's kinda like a workaround but it is working, if you're doing aggregation.
Otherwise depending of one's reactivemongo version, one can simply set collation at index creation

def aggregate(pipeLine: BSONArray): Future[JsObject] = {

    val commandQuery = BSONDocument(
      "aggregate" -> "mycollection",
      "pipeline" -> pipeLine,
      "collation" -> BSONDocument("locale" -> "en", "strength" -> 1)
    )

    val runner = Command.run(BSONSerializationPack)
    db.flatMap(db => {
      runner.apply(db, runner.rawCommand(commandQuery)).one[JsObject]
    })
  }

@cchantep
Copy link
Member Author

Hi,
hope this will help someone, it's kinda like a workaround but it is working, if you're doing aggregation.
Otherwise depending of one's reactivemongo version, one can simply set collation at index creation

def aggregate(pipeLine: BSONArray): Future[JsObject] = {

    val commandQuery = BSONDocument(
      "aggregate" -> "mycollection",
      "pipeline" -> pipeLine,
      "collation" -> BSONDocument("locale" -> "en", "strength" -> 1)
    )

    val runner = Command.run(BSONSerializationPack)
    db.flatMap(db => {
      runner.apply(db, runner.rawCommand(commandQuery)).one[JsObject]
    })
  }

Rather have a look at https://javadoc.io/doc/org.reactivemongo/reactivemongo_2.13/1.0.0/reactivemongo/api/collections/GenericCollection.html#aggregatorContext[T](pipeline:List[GenericCollection.this.PipelineOperator],explain:Boolean,allowDiskUse:Boolean,bypassDocumentValidation:Boolean,readConcern:reactivemongo.api.ReadConcern,readPreference:reactivemongo.api.ReadPreference,writeConcern:reactivemongo.api.WriteConcern,batchSize:Option[Int],cursorOptions:reactivemongo.api.CursorOptions,maxTime:Option[scala.concurrent.duration.FiniteDuration],hint:Option[GenericCollection.this.Hint],comment:Option[String],collation:Option[reactivemongo.api.Collation])(implicitreader:GenericCollection.this.pack.Reader[T]):GenericCollection.this.AggregatorContext[T]

@seyuf
Copy link

seyuf commented Oct 24, 2020

Thanks @cchantep you're the mvp ;)

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

No branches or pull requests

7 participants