Asynchronous & Non-Blocking Scala Driver for MongoDB
Questions tagged [reactivemongo]
508 questions
6
votes
2 answers
Get ID after insert with ReactiveMongo
I'm writing a web service with akka-http and ReactiveMongo.
I faced with problem, which I unable to resolve by myself.
I have method
def saveRoute(route: Route)(implicit writer: BSONDocumentWriter[Route]): Future[WriteResult] = {
…

green-creeper
- 316
- 3
- 15
6
votes
2 answers
How to install ReactiveMongo on play 2.4?
I have installed the following:
1.Play 2.4
2.Created a scala project
3.added the eclipse plugin
Now I wanted to add a database connection. I want to tryout ReactiveMongo, but the instructions on the wiki page are for 2.3 or older. …

pitchblack408
- 2,913
- 4
- 36
- 54
6
votes
5 answers
How to query with '$in' over '_id' in reactive mongo and play
I have a project set up with playframework 2.2.0 and play2-reactivemongo 0.10.0-SNAPSHOT. I'd like to query for few documents by their ids, in a fashion similar to this:
def usersCollection = db.collection[JSONCollection]("users")
val ids:…

mcveat
- 1,416
- 15
- 34
5
votes
1 answer
High level of what I will need to do to port ReactiveMongo scala to use cats effects?
Is it correct to say that if I wanted to use ReactiveMongo in something like http4s I will have to wrap all the Future calls that ReactiveMongo returns in a Cats IO effect?
At a high level, what are the steps I would need to incorporate…

Blankman
- 259,732
- 324
- 769
- 1,199
5
votes
2 answers
(Reactive)Mongo test failing with: unrecognised field 'snapshot'
My tests running in BitBucket pipeline 'suddenly' started to fail with this error: unrecognised field 'snapshot' (code = 9).
Locally the test all run fine though.
Both locally and in BitBucket I'm using a Mongo 3.7 docker container.
Reactive Mongo…

Joost den Boer
- 4,556
- 4
- 25
- 39
5
votes
1 answer
How to return Enumerator of JSON from ReactiveMongo in Play 2
In our project we are using ReactiveMongo with Play 2.2.1.
The problem is, that to stream of data in a form of Enumerator[A], returned by ReactiveMongo is actually a stream of value objects, which are not separated by commas, and do not have stream…

mavarazy
- 7,562
- 1
- 34
- 60
5
votes
1 answer
Play: How to implement vermongo with ReactiveMongo
I want to update a JSON document in MongoDB like this:
{
"_id":{"$oid":"52dfc13ec20900c2093155cf"},
"email": "joe@domain.com",
"name": "joe",
"_version": 2
}
... and want to create a vermongo document like this on each update:
{
"_id {…

j3d
- 9,492
- 22
- 88
- 172
4
votes
1 answer
How to store date in MongoDB in ISO format instead of Long [Play, Scala and ReactiveMongo]?
I'm trying to insert date in MongoDB using following way:
collection.insert(Json.obj("user"->"abc", "joined_date" -> DateTime.now))
In database:
{
"_id" :…

Ra Ka
- 2,995
- 3
- 23
- 31
4
votes
2 answers
How to get the document object id after insert in reactivemongo?
I have seen that this question seems to have been asked earlier (almost 3 years ago), but since then there might be lot of changes in the reactive mongo library.
I am using the play plugin with version 2.4, but the…

Gaurav Abbi
- 645
- 9
- 23
4
votes
1 answer
BSONDocument to byte array
I'm trying to post BSONDocument read from mongo to AWS Kinesis stream. However Kinesis API needs message as Byte array. Is there any way to covert BSONDocument(specifically reactivemongo.bson.BSONDocument) to byte array?

Hiren
- 708
- 1
- 7
- 14
4
votes
1 answer
Getting DatabaseException 'not authorized for query on db.collection' (code = 13) after mongo3 upgrade
I use the free MongoLab, and my database was upgraded to Mongo 3 over the weekend and now my client won't connect. I keep getting a 'not authorized for query on db.collection.' error.
Mongolab says I should use Mongo 3 compatible driver…

Dave DeCaprio
- 2,051
- 17
- 31
4
votes
2 answers
Console scala app doesn't stop when using reactive mongo driver
I'm playing with Mongo database through the Reactive Mongo driver
import org.slf4j.LoggerFactory
import reactivemongo.api.MongoDriver
import reactivemongo.api.collections.default.BSONCollection
import reactivemongo.bson.BSONDocument
import…

Alexander Kondaurov
- 3,677
- 5
- 42
- 64
4
votes
1 answer
Play Framework cache Remove elements matching regex
I was wondering if there is a way to delete elements from the Play cache using a regex.
I'm using play 2.2.x and I'm storing elements in the cache following this pattern:
collectionName.identifier
Is there a way to expire the caché using a regular…

Bruno Follon
- 422
- 3
- 13
4
votes
1 answer
Play (Scala), Reactivemongo and multiple databases
So, been working on a smaller project with Play, ReactiveMongo and MongoDB. My question is about the application.conf part for ReactiveMongo, have the standard googlable one:
mongodb = {
db = "db1"
servers = [ "localhost:27017" ]
credentials =…

Wrench
- 4,070
- 4
- 34
- 46
4
votes
1 answer
Processing jobs from capped collection until interrupted using ReactiveMongo
I have a jobs_queue collection in MongoDB. It's a capped collection which I'm polling using a tailable cursor:
val cur =
jobsQueue
.find(Json.obj("done" -> Json.obj("$ne" -> true)))
.options(QueryOpts().tailable.awaitData)
…

Erik Kaplun
- 37,128
- 15
- 99
- 111