Questions tagged [spring-mongodb]

Do not use this. Use [spring-data-mongodb] instead.

Do not use this. Use instead.

422 questions
0
votes
1 answer

Nested Group with Spring MongoDB

I need to generate a result with the number of alerts of each level for each user. A structure similar to the following: { "identitity": "59e3b9dc5a3254691f327b67", "alerts": [ { "level": "INFO", "count": "3" }, { …
0
votes
1 answer

What is the best way to retrieve the count of users with complete and incomplete profiles using spring boot and mongodb?

Problem 1)I have to display the count of total users with Incomplete and Complete Profiles. 2)Incomplete Profiles are those which will have 4 fields of String type. Other than that all are Complete Profiles. Below is my model class…
Jalaj Chawla
  • 189
  • 1
  • 3
  • 18
0
votes
0 answers

Querying Embedded document in MongoDB using Mongo Template

I have the above domain structure where I have list of Companies in the product and the aim is not make entry in mongoDB when I have exact match for companies & productId already present in the DB. @Entity public class Mobile { @Id …
0
votes
2 answers

how should i get data from mongo db using spring mongo repository?

i am using mongodb in my spring boot application and i am using mongo repository interface to get data from the database this is the way i am getting the data . School sch=repository.findOne("id"); this will give me the school object then i…
ashutosh
  • 81
  • 1
  • 1
  • 9
0
votes
1 answer

Spring MongoRepository#findall: ConverterNotFoundException

I have two simple documents MyDoc and NestedDoc MyDoc: public class MyDoc { @Id private final String id; private final NestedDoc nested; public MyDoc (MyIdentifier myIdentifier, Nested nested) { …
Doe Johnson
  • 1,374
  • 13
  • 34
0
votes
1 answer

Spring Integration MongoDbStoringMessageHandler ClassCastException: BasicDBObject cannot be cast to BasicDBList

I have developed an integration flow where I get the users from a MongoDbMessageSource and for each social medium associated with the user I get the comments addressed to him. Those comments I want to persist them in MongoDB with help of…
0
votes
1 answer

MongoDB aggregate multiple group by top fields and array fields

My collection will look like this, { "_id" : ObjectId("591c5971240033283736860a"), "status" : "Done", "createdDate" : ISODate("2017-05-17T14:09:20.653Z") "communications" : [ { "communicationUUID" :…
venkat.s
  • 120
  • 1
  • 6
0
votes
1 answer

Count Documents Matching Multiple Array Criteria

Schema is: { "_id" : ObjectId("594b7e86f59ccd05bb8a90b5"), "_class" : "com.notification.model.entity.Notification", "notificationReferenceId" : "7917a5365ba246d1bb3664092c59032a", "notificationReceivedAt" :…
Shubham A.
  • 2,446
  • 4
  • 36
  • 68
0
votes
0 answers

Spring boot rest is adding extra field "target"

@Document("user") public class User @Id String id; @DbRef(lazy=true) Group group; } @Document("Group") public class Group{ @Id private String Id; private string code; } JSON User [ { "id": "5922bccbbba56342fc55a73f", …
Saurabh Kumar
  • 16,353
  • 49
  • 133
  • 212
0
votes
1 answer

Spring JPA With mongo Supporting Contains and LessThan

I am using Spring JPA with mongo.I have a requirement to use contains query on one of the fields.If end users(UI/Service) hits the GET Request and looks for information in EMAIL Field,I need to search based on text.Pretty much it is…
MrWayne
  • 309
  • 1
  • 9
  • 20
0
votes
1 answer

How to use mongodb aggregate functions in Criteria?

I am working on a project where I use spring data mongodb. I am making a mongo query like this: Query query = new Query(); Criteria one = Criteria.where(DB_FIELD_1).gt(1); Criteria two = Criteria.where(DB_FIELD_2).lt(10); Criteria final = new…
user3528213
  • 1,415
  • 3
  • 15
  • 18
0
votes
0 answers

Spring MongoDb template for shell commands

I am trying to create an application where I can pass the shell commands for mongoDB and then execute it in java. One of the exmaple I tried is as below DBObject dbobject=(DBObject) JSON.parse("{$and:[{sections.data.rowIdx: {$in:…
athenatechie
  • 699
  • 2
  • 8
  • 15
0
votes
1 answer

Nested search using MongoDB template

I have below document in Mongo DB and I wrote a java code to get data from innermost element . For some reason its not returning me any results for it. Input data { "_id": "59036b0fa036cc28c8e07db6", "srcName":"test1", "sections": [{ "_id":…
athenatechie
  • 699
  • 2
  • 8
  • 15
0
votes
1 answer

Mongo DB / No duplicates

I have have a mongo collection that keeps state records for devices. Thus, there could be multiple records per device. What I would like to do is create a query through the mongoTemplate that gets the latest record for each device. Here's the…
Sam
  • 51
  • 6
0
votes
1 answer

Agrregation using mongoDBtemplate for Nested document

I am trying to use agrregation using spring mongodb template. The grouping has to be done on third level of document. input document is { "_id": "59036b0fa036cc28c8e07db6", "sections": [{ "srcName": "test1", "data": [{ …
athenatechie
  • 699
  • 2
  • 8
  • 15