I have the following Java POJO in my spring boot application:
public class Round {
private ObjectId _id;
@NotEmpty
@Getter
@Setter
@Accessors(fluent = true)
@JsonProperty("userId")
…
I just doing simple transactions like :
findByVariable(String variable);
manipulate the data, then
save(data);
but i got Exception like this
org.springframework.dao.OptimisticLockingFailureException: Optimistic lock exception on saving entity:…
Trying to use embedded mongodb for my spring local profile. Here is the configuration for MongoTemplate
@Configuration
@Profile("local")
public class LocalMongoConfig {
private static final String MONGO_DB_URL = "localhost";
private static…
i am new to mongodb repleca set
spring boot 2.2.2
mongo db driver 3.12.1
spring.data.mongodb.uri=mongodb://user:pass@server1:27017,server2:27017,server3:27017/DB?replicaSet=mongodb_rs
always getting the following error while fetching data from…
What is the recommended way to iterate over a large result with reactive mongo template?
I can't find a reactive alternative for the blocking MongoTemplate::stream() operation, which uses MongoDB cursor (and works perfectly well).
When I do the most…
I'm getting this error on connect:
com.mongodb.MongoSocketReadException: Prematurely reached end of stream
I have looked at the other SO answers and they do not help.
I can connect from MongoDB compass with LDAP authentication, the same keys that…
I have a repository method like this
@Query({'date': ?0})
public List findForDate(LocalDate date);
and I am using it like this
repository.findForDate(LocalDate.now());
because I want to fetch my current log entries. Repo returns empty…
The code below causes presumably memory leak:
public int reregister(ReregisterDTO reregisterDTO) {
AtomicInteger count = new AtomicInteger(0);
StreamUtils.createStreamFromIterator(
mongoTemplate
…
Can I cancel delete event using onBeforeDelete method of MongoGenreCancelDeleteEventsListener? If yes then how?
@Component
public class MongoGenreCancelDeleteEventsListener extends AbstractMongoEventListener {
private final BookRepository…
I am making a very silly mistake but not able to figure out how to fix.
I have a simple SpringBoot app using profiles, which connect to MongoDb.
My pom.xml dependencies:
org.springframework.boot
…
In the following query, I'm trying to use $objectToArray mongo aggregated function in a SgringMongo. Can someone help me, please?
I couldn't find any way to convert it to a SpringMongo query
db.getCollection('application').aggregate([
…
I try to load initial json documents into mongodb database with spring boot. First, These are mongodb documents schema.
@Document(collection="Posts")
public class Post {
@Id
private String _id;
@Indexed(unique = true)
private…
So, I have one @Document class which has a embedded pojo field which I want it to be unique for the document based on a key in the pojo class. I tried using @CompoundIndex & @Indexed to mark it as unique but it doesn't seem to work.
@Document
public…
I am using Spring Boot and lombok in my project and encounter some issues with it.
My class looks like this:
import org.springframework.data.annotation.Id;
import org.springframework.data.mongodb.core.mapping.Document;
import…