mongodb « Database « Spring Q&A





1. Spring framework + NoSQL    stackoverflow.com

It's already 18 hours that i'm playing with Spring framework. It's beautiful, really amazing. As far as i can see spring knows how to work rdbms databases . Can anyone tell ...

2. Morphia logging over log4j in spring    stackoverflow.com

I want to log Morphia over Sfl4j with log4j. From Morphia's documentation:

Add this at the start of your application. It is done once, statically. MorphiaLoggerFactory.registerLogger(SLF4JLoggerImplFactory.class);
I can't ...

3. Unexpected MongoDB "OR" query behaviour    stackoverflow.com

I'm testing out spring-data and it's mongodb support. I have a question about the query creation when using or-queries. Consider the following:

Query query = new Query().or(new Query(where("receiverId").is(userId)), new Query(where("requesterId").is(userId)));
query.and(where("status").is(status));

This will result ...

4. Using Morphia with Spring    stackoverflow.com

The Google Code site of Morphia says it "works great with Guice, Spring, and other DI frameworks." I'm learning Spring at the moment, so i'm just experimenting with connecting these two tools. I've ...

5. Endless MongoDB ReplicaSetStatus updater exceptions using the Java driver in Spring    stackoverflow.com

I just deployed a Spring web application onto Glassfish. This app contains an injected Spring bean for the Mongo object, which is pretty basic, it just looks like this:

<bean id="mongo" class="com.mongodb.Mongo">
 ...

6. Endless replicaset connection error with spring data support and mongodb    stackoverflow.com

I'm working in a apps where I'm using mongodb with replicaset. In my replicaset I've 2 db servers and 1 arbiter. I'm creating my mongo object as follows

List<ServerAddress> servers = new ArrayList<ServerAddress>();
servers.add( ...

7. Force property order in Spring Data MongoDB mapping    stackoverflow.com

I have a Location object that I need to force the order of the properties when they get persisted to mongodb, but I'm not having much luck figuring out how to ...

8. Spring Data (mongoDB), findBy proxied method on repository doesn't work with null values    stackoverflow.com

I have a proxied method in a MongoRepository extender class like this:

public interface InvitationRepository extends MongoRepository<Foo, String>
{
    public Foo findByUserIdAndDestinationMail( String userId, String destinationMail );
}
When I try to ...

9. Does MongoDb XSD for Spring Data - Document define a db-factory element?    stackoverflow.com

Spring Data - Document documentation gives and example of configuring a factory bean for creating MongoDB connections using mongo:db-factory element.

<mongo:db-factory id="anotherMongoDbFactory"
      ...





10. how to map a collection of enums in spring-data for mongodb    stackoverflow.com

spring-data 1.0.0.M3 with MongoDB. How come spring can map this class:

import org.springframework.data.document.mongodb.index.IndexDirection;
import org.springframework.data.document.mongodb.mapping.Document;

@Document
public class EnumsMapper { 
  private IndexDirection d = IndexDirection.ASCENDING;
}
and fails with this one:
import org.springframework.data.document.mongodb.index.IndexDirection;
import org.springframework.data.document.mongodb.mapping.Document;
import java.util.List;
import ...

11. Spring data MongoDb: MappingMongoConverter remove _class    stackoverflow.com

The default MappingMongoConverter adds a custom type key ("_class") to each object in the database. So, if I create a Person:

package my.dto;
public class Person {
    String name;
  ...

12. Is it possible to have a @DBRef annotated list with different object types in it when using Spring-Data MongoDB support?    stackoverflow.com

Is it possible to have a @DBRef annotated list with different object types in it when using Spring-Data MongoDB support? If so, how can that be accomplished?

13. How to map generic collections with Spring Data(MongoDB)?    stackoverflow.com

I have some problems with mapping my inner collection. Items can have different content types. Here is my Item class:

@Document(collection = "items")
public class Item{
@Id
private ObjectId id;   
private List<? super ...

14. How do I set up custom Mongo formatters in Spring?    stackoverflow.com

I've been at this for a few hours and haven't found anyone that's gotten this working yet. I want to persist a BigDecimal object in Mongo, but Mongo doesn't natively ...

15. Is this a bug with spring-data or there any other way to save the object of class B to database?    stackoverflow.com

abstract public class A < T > {

private String item1;
....
private String item2;

private List < T > itemizedList ;

<getters and setters>

}

class B extends A <B> {

private String item3;
...

<getters and setters>

}
When we try ...

16. resolving mongodb references in spring    stackoverflow.com

Let's assume that I have the following documents in mongodb in the employees collection:

db.employees.insert({_id: ObjectId("4d85c7039ab0fd70a117d733"), name: 'Siona',
manager: [ObjectId("4d85c7039ab0fd70a117d730"), ObjectId("4d85c7039ab0fd70a117d732")] })
Here, 'Siona' has two managers, indicated in the managers array. I know ...





17. mongo db - can't initiate Mongo with replica set    stackoverflow.com

I'm using version spring-data-mongo version 1.0.0.M4 - the latest version to this date. I defined my bean like this:

<bean id="mongoOps" class="org.springframework.data.mongodb.core.MongoTemplate">
    <constructor-arg ref="mongo" />
    <constructor-arg name="databaseName" ...

18. Problem with implementing Sort in Spring Data (Mongodb)    stackoverflow.com

I need to do the following sql query using spring data api:

Select * from TagTest where tagName = "water temperature" Order by timestamp desc;
I came up with the query:
Query query = ...

19. mongo query for selecting count of all unique ids in a collection    stackoverflow.com

In mongodb, I have a comments database with a collection of comments. Each comment has a "videoId" field that represents which video the comment belongs to. How do I write a ...

20. CouchDb - MongoDb and NoSQL Databases Comparision (working with XML Documents)    stackoverflow.com

I am working on a project using Java and Spring 3. There is a new task for me. There will be Xml files and I get that files and convert them ...

21. Mongo Db and Spring    stackoverflow.com

I want to work on Mongo DB with Spring 3. Is there any simple application and tutorial based on that application that I can follow to learn it?

22. Adding sort to mongo JSON @Query with Spring Data Repository    stackoverflow.com

I want to sort the results of a find using the mongo JSON query and having done some reading and experimenting, I still can't get it to work. I ...

23. com.mongodb.MongoInternalException: DBPort.findOne failed    stackoverflow.com

I am trying to adopt that example into my existing Spring application. However I get that error:

Error creating bean with name 'mongo': Invocation of init method failed; nested exception ...

24. Spring MongoDb Exists or Not    stackoverflow.com

I follow that tutorial: http://krams915.blogspot.com/2011/02/spring-data-mongodb-tutorial.html However I want to add a function to PersonService. I want to check if exits or not by pid. How can I do that( at simple ...

25. How to Create a capped collection with Spring Data? - MongoDB    stackoverflow.com

I'm working on a simple project. I'm using SpringData and MongoDB. Everything is perfect creating normal collections, but now I have to register information, I mean a logging functionality. So I read ...

26. DBRefs (Mongo Document references) not fetched eagerly    stackoverflow.com

I am using Mongo in its simplest avatar possible (in conjunction with Spring Data). I have two (first class) entities (@Documents) A and B, where A has a reference (@DBRef) of B ...

27. Derived Queries not working with DBRef    stackoverflow.com

I am using Mongo with Spring Data. I have two (first class) entities (@Documents) Entity1 and Entity2, where Entity1 has a reference (@DBRef) of Entity2 within it. Everything works fine, but when ...

28. Spring PropertyPlaceholderConfigurer and MongoDB replica-set    stackoverflow.com

In my spring context, I am using PropertyPlaceholderConfigurer to load up properties from env.properties:

<bean id="propertyPlaceholderConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
       <property name="locations">
        ...

29. Mongo - Ignore property from being persisted    stackoverflow.com

I have a standard POJO that has a set of properties in it. The POJO has been annotated as a @Document, so as to be persisted in MongoDB as a Document. How ...

30. MongoDB "OR" query behaviour    forum.springsource.org

I have a question about the query creation when using or-queries. Consider the following: Code: Query query = new Query().or(new Query(where("receiverId").is(userId)), new Query(where("requesterId").is(userId))); query.and(where("status").is(status)); This will result in the following mongodb ...

31. Spring Data MongoDB Query Result Mapping    forum.springsource.org

Spring Data MongoDB Query Result Mapping I have the following domain and repositories Code: // domain @Document(collection="users") public class User { @Id private ObjectId id; private String name; private List activities; ...

32. resolving simple mongodb references in spring w/o dbref    forum.springsource.org

resolving simple mongodb references in spring w/o dbref Let's assume that I have the following documents in mongodb in the employees collection: db.employees.insert({_id: ObjectId("4d85c7039ab0fd70a117d733"), name: 'Siona', manager: [ObjectId("4d85c7039ab0fd70a117d730"), ObjectId("4d85c7039ab0fd70a117d732")]}) Here, 'Siona' ...

33. MongoDB create spatial index    forum.springsource.org

Code: public class Poi { private String name; private String type; private Point point; public Poi(String name, String type, double lon, double lat) { this.name = name; this.type = type; this.point ...

34. How to implement a custom MongoDB repository    forum.springsource.org

How to implement a custom MongoDB repository Hi there, I'm trying to implement a custom repository for a MongoDB entity, but it doesn't seem to be recognized... I have this : ...

35. CrudRepository and MongoDB - saving two equal objects / updating object    forum.springsource.org

CrudRepository and MongoDB - saving two equal objects / updating object Does org.springframework.data.repository.CrudRepository (with MongoDB) supports updating object that is already persisted via repository "save" method? First of all, if object ...

36. Issue with QueryDSl support and MongoDB    forum.springsource.org

I am new to this project. My persistence object has following attributes firstName, lastName and address where address is embedded. when I try to run the following query, I get 'address ...

37. MongoDB: How to use a custom converter for an embedded property / field    forum.springsource.org

MongoDB: How to use a custom converter for an embedded property / field Hi, in a project using mongoDB I have a bean with a custom id type that I want ...

38. MongoDB @Query with Pageable    forum.springsource.org

MongoDB @Query with Pageable Hello, I'm having a really difficult time figuring out (if possible) to use the @Query annotation along with the pagable parameter. For instance, if I have the ...

39. MongoDB - How to create objects refering to each other properly?    forum.springsource.org

Roo: 1.2.0.M1 [rev 1fa252f] MongoDB: 2.0.1 I have two entities, Dummy and Dummy2. They refer to each other. Code: public class Dummy { private String dummyString; @DBRef private Dummy2 dummy2; } ...

40. Spring Batch DAOs with MongoDB    forum.springsource.org

Hi, folks! I am using Spring Batch with NoSQL database, so I couldn't use the standard JDBC DAOs for Spring Batch metadata. Here's MongoDB implementation - http://jbaruch.wordpress.com/2010/04...-spring-batch/ The new implementation passes ...

41. Spring Secuirty /w NoSQL (mongodb) database    forum.springsource.org

Spring Secuirty /w NoSQL (mongodb) database I looking for help/examples of how to implement Spring Security using a no sql database, specifically mongodb. I have a collection of username/password in a ...