I'm trying to find Near by places.
Below code is working fine.
But i'm not able to get actual distance of place from my given lat,lng.
Criteria criteria = new Criteria("coordinates")
.near(new…
I have a Mongo collection annotated with @Document and I want the possibility to also get that Java object from a String (JSON) as we're getting these classes pushed into a queue as String.
Is there a method in Spring-Data-Mongo which converts from…
I want to insert into an array-list in an embedded data. I tried several ways but couldn't make it out. My data structure is something like this. The code given here is just a dummy reference to my original data structure
Class X{
Integer…
We are working with MongoDB.
We have an object with an attribute which is a set of SubscriptionFeature, where the SubscriptionFeature is an enum.
public class Business {
...
private Set additionalFeatures;
...
}
Sometimes we…
I need to update around 1-1.5 million documents in a Mongodb collection.
Is updateMulti() an efficient way to update the document? I mean will it update the documents in batches internally?
import…
I need to translate following MongoDb group aggregation to Java code:
{
$group: {
_id: {"startDate": {$ifNull: ["$startDate", null]}, "name": {$ifNull: ["$name", null]}},
"items": {
$push: "$$ROOT"
…
I'm trying to store java.lang.Class in MongoDb using ReactiveCrudRepository, but I got this following errors.
@Document
data class Letter(
...,
val messageType: Class<*>
)
Can't find a codec for class java.lang.Class.
I tried implementing my…
I have mongodb collection for following documents:
@Builder
@Data
@AllArgsConstructor
@NoArgsConstructor
@Document
public class Account {
@Id
private String id;
@Indexed(unique=true)
private String username;
…
Unable to store date in IST format in mongo DB
Currently storing date in UTC format during every operations i have to change it into IST format using timezone feature provided by mongo
I have the following data which I am querying on:
[
{
"_id": 1,
"domainName": "test1.com",
"hosting": "hostgator.com",
"to": "nanjing",
"travelDate": "09/06/2022",
"trainNumber": 123
},
…
this is my mongo db document
classA {
private String name;
private long elapsedTime; // newly added field
}
@Document
classB extends classA{
private String id;
private String owner;
}
classBRepository.save(classBObject);
but newly added…
I am trying to create a custom Query annotation in a MongoRepository. Everything is fine except the date comparison. I need to find all items that were created on a specific day, so I give 2 date objects with the good date and the times fixed to…
I need to start using @Document annotation (org.springframework.data.mongodb.core.mapping.Document) on a class which is used as an entity for mongodb. This class currently uses the @BsonDiscriminator annotation…
I'm working on a Spring Boot multi-module project. I have created separate modules as follows
com.foodshop.api - (this is a Spring Boot project, the starting point and both com.foodshop.application and com.foodshop.persistence are added as…