Questions tagged [gmongo]

A more simple, easy to use and less verbose API to work with mongodb using the Groovy programming language

GMongo provides a wrapper on top of the Java MongoDB driver. This allows you to use the Java driver in a more 'groovy' manner. The source for this library is available on GitHub.

18 questions
8
votes
1 answer

Mongo CursorNotFound exception in active cursor via Grails domain criteria

I'm using Grails 2.4.4, mongo plugin 3.0.2, MongoDB 2.4.10 using a remote database connection. grails { mongo { host = "11.12.13.14" // A remote server IP port = 27017 databaseName = "blogger" username =…
Shashank Agrawal
  • 25,161
  • 11
  • 89
  • 121
4
votes
1 answer

Create a mongo connection and make it alive for execution of an Entire Test Suite in Ready!API

If you want to make an gmongo connection alive for an entire test suite and then close it in a tear down operation after the entire test suite is executed then, How could we do that? Currently what am I doing is, I am creating an connection for an…
subby
  • 71
  • 6
4
votes
2 answers

How to intercept and log mongodb queries?

How do I get the exact query sent from gmongo driver to mongod (for debugging purposes). In mysql it is achieved by adding logSql = true to datasource. I am writing an aggregate query with a matching pipeline between a start and end date. The…
Merhawi Fissehaye
  • 2,482
  • 2
  • 25
  • 39
3
votes
0 answers

Is there a replacement for GMongo in the Grails Gorm-MongoDB Plugin?

I am dealing with an extremely large code base that heavily uses the GMongo library to simplify access to the mongo database. As I understand, beginning with GORM for MongoDB 5.0, gmongo was removed. I now have a need to upgrade my mongo java…
3
votes
0 answers

Do GORM / GMongo wrap collections to accept Maps? (Grails / GMongo internals.)

I'm working with Grails Mongo domain objects and I've noticed that I get very different behavior with the following two ways to access a collection: c1: collection name is known at compile time: def c1 = MyDomainClass.collection c2: collection name…
Bosh
  • 8,138
  • 11
  • 51
  • 77
2
votes
2 answers

Multiple insert into mongodb - only the first collection gets updated

I am trying to update my collections in my mongodb instance hosted on mlab. I am running the following code: ... db.collectionOne.insert(someArrayOfJson) db.collectionTwo.insert(someArrayOfJson) The first collection gets updated and the second…
user7138697
2
votes
1 answer

Connect to remote MongoDB replica set, when replica set connect to each other on local IP addresses

We have setup a mongo replica set on a local network interface (i.e. 192.168.1.x). The replica set members are the only ones that know about this interface. The instances are also on an external interface that is addressable from inside our…
Scott
  • 16,711
  • 14
  • 75
  • 120
1
vote
1 answer

doEval() With Multiline String Argument

Using Groovy 2.3.6, GMongo 1.2, Java 1.8, MongoDB 3.0.0... I'm trying to use doEval() to get a count of documents in a collection. (For various reasons I want to use doEval() rather than count()). Invoking doEval() with a single line string argument…
Mike Munhall
  • 113
  • 2
  • 7
1
vote
1 answer

can I use mongdb plugin and gmongo together in grails project?

recently, I am working in a grails project and intend to use mongodb as our nosql database, besides mysql. I added mongodb plugin, do a test with a domain and it work well (show/edit/save...): compile ':mongodb:3.0.1' and try another method using…
hakuna1811
  • 524
  • 5
  • 11
1
vote
2 answers

mongodb gmongo runCommand

I'm working on a grails/mongodb project. I want to do a full text research on a mongodb database using: db.test.runCommand( "text", { search : "my_texte" } ) The problem is that I didn't found how to do it in groovy (or using gmongo). How do …
CC.
  • 2,736
  • 11
  • 53
  • 70
1
vote
1 answer

Calculate distance in MongoDB is not accurate

I'm trying to build a spacial query on my MongoDB database (in order to find all results using geoNear. It works, except that the calculated distance is not accurate at all. So, here is what I have: > db.status.find() { "_id":NumberLong(5), …
CC.
  • 2,736
  • 11
  • 53
  • 70
0
votes
2 answers

Groovy gmongo batch processing

I'm currently trying to run a batch processing job in groovy with Gmongo driver, the collection is about 8 gigs my problem is that my script tries to load everything in-memory, ideally I'd like to be able to process this in batch similar to what…
0
votes
1 answer

How to create mongodb collection without _id

My project was build on GMONGO framework and all the domains were created with attribute id as a string.So grail frame work will create mongodb collections with _id attribute when application is app. In UI there was a limitation to retrive…
Raj
  • 173
  • 3
  • 9
0
votes
1 answer

GMongo search within an embedded json in an object

I have the following object: How can I search for it by only the startDate and endDate fields in the content sub-json? I tried: collection.findOne(content: [startDate : givenStartDate, endDate : givenEndDate]) But I guess this would return it…
Alexandr
  • 708
  • 9
  • 29
0
votes
1 answer

gmongo MapReducer with Finalizer

I do not know how to set Finalizer when using gmongo. My 'reduce' contains an Array that I want to use in 'Finalize' Map and Reduce are as shown below String map=""" function map(){ key = this.vendor var…
patb23
  • 387
  • 5
  • 21
1
2