I am trying to get Data from a mongoDB with a repository. But when I call the "find" methods, java throws a MongoQueryException and tells me, that find requires authentication. I want to configure my application over a XML file and…
below is my code -
MatchOperation match_Status_Count = new MatchOperation(
Criteria.where("date1").gte("2019-3-25T17:34:24.734Z").andOperator(
Criteria.where("date1").lte("2019-11-25T17:34:24.734Z")
…
I have a Mongo collection with documents like this:
a: { product: 1, country: 2, stock: 1}
b: { product: 1, country: 3, stock: 3}
c: { product: 2, country: 1, stock: 1}
Sometimes I want to get the stock of a product in all countries (so I retrieve…
I would like to save some documents with the value containing a generic. And I constantly receive a StackOferflowError.
Here is a fragment of my model class
data class MyDocument {
val errors: List = emptyList()
}
SomeError is in…
I add this properties to my spring boot application:
spring.data.mongodb.host=localhost
spring.data.mongodb.port=27017
spring.data.mongodb.database=library
and write code:
User user = new User();
user.setFirstName("Name");
…
I have json data where the key contains dots as '123.456' and value as object.
{
"models": {
"123.456": [{
"key1": "value1",
"key2": "value2"
}]
}
}
I am getting an…
I having trouble doing a custom query with spring-data-mongo repository.
I have the next code:
@RestResource
public interface RecipeRestRepository extends MongoRepository {
@Query(value = "{'title': {$regex : ?0, $options:…
I have a Springboot App that is using MongoDB as the database. One of the collections has a string field and query on that field is taking very long, I am unable to tune it. I have created index but still there is no improvement. Here is my…
I have mongodb related code in my java application and can I switch between two collections under same db in java code ?
@JsonIgnoreProperties(ignoreUnknown = true)
@Document(collection = "collectionA")
@QueryEntity
public class RepreCase {
I want…
I am trying to run aggregation query where trying to unwind the array which is nested under the key customFields.
Structure is like this
{
"note" : {
"customFields" : {
"externalAttendees" : [
{
…
I'm using Spring 5.1+ with MongoDB. One of my classes is annotated with @Document so it gets picked up by MongoDB, however this is causing the program to fail tests as it times out waiting for the Mongo Service which isn't running.
Is there a way to…
The following example works perfectly.
MatchOperation matchStage = mongodbConstructorQueryUtils.makeMatchStage(topCriteria);
GroupOperation groupStage = Aggregation.group("teamId", "teamName")
…
I am using mongoOperations of Spring Data mongodb to store in MongoDB// mongoOperations.save(reqObj);
I need to save the same JSON document which i am getting as rest API response in two collections.
@Document(collection="collection_a")
public…