I’m Workin with Mongo using Jongo, when I do a query I receive a LinkedHashMap as result. the problem is that if the json is {“user”:”something”} content will be {user=something}, it is not a json is only toString method from HashMap. How I can get the original JSON? I don’t have a class to map the response and it isn’t
Tag: mongodb
What’s the difference between Spring Data’s MongoTemplate and MongoRepository?
I need to write an application with which I can do complex queries using spring-data and mongodb. I have been starting by using the MongoRepository but struggled with complex queries to find examples or to actually understand the Syntax. I’m talking about queries like this: or the use of JSON based queries which I tried by trial and error because
Mongodb avoid duplicate entries
I am newbie to mongodb. May I know how to avoid duplicate entries. In relational tables, we use primary key to avoid it. May I know how to specify it in Mongodb using java? Answer Use an index with the {unique:true} option. You can also do this across multiple fields. See this section in the docs for more details and
Spring-data-mongodb connect to multiple databases in one Mongo instance
I am using the latest spring-data-mongodb (1.1.0.M2) and the latest Mongo Driver (2.9.0-RC1). I have a situation where I have multiple clients connecting to my application and I want to give each one their own “schema/database” in the same Mongo server. This is not a very difficult task to achieve if I was using the driver directly: See, easy. But
spring-data-mongo – optional query parameters?
I am using spring-data mongo with the JSON based query methods, and am unsure how to allow optional parameters in a search query. For instance – say I had the following function -but I didnt want to apply the name regex match, or not apply a date range restriction if NULL values were passed to the method. At the moment
How to insert a MongoDB document with a timestamp from the database server
In Oracle, I could simply do this: That would insert two values into myTable, and one of them would be a timestamp based-on the database server’s time. For MongoDB (via the Java driver) I’ve tried this: But that creates a timestamp based-on the client machine’s time, not the database server’s time. Is there a way to have MongoDB apply a
Embedded MongoDB when running integration tests
My question is a variation of this one. Since my Java Web-app project requires a lot of read filters/queries and interfaces with tools like GridFS, I’m struggling to think of a sensible way to employ MongoDB in the way the above solution suggests. Therefore, I’m considering running an embedded instance of MongoDB alongside my integration tests. I’d like it to