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

mongodb : Failed to instantiate com.sun.org.apache.xerces.internal.jaxp.datatype.DurationImpl. Bean created using factory method

I created an application with springboot+mongoDB. I have a class Test which has an instance variable duration of class "javax.xml.datatype.Duration". Duration is an abstract class. I am able to save data using rest request.But when I am retrieving…
0
votes
0 answers

Spring Boot get subset of nested array from mongo document

I have a Post document in Mongo DB, which has an array of comments. class Post { String id, User user, List comments } The class structure looks as above. Now I would like to use mongoTemplate in order to retrieve a sliced content of…
Kency Kurian
  • 182
  • 2
  • 11
0
votes
1 answer

Required String parameter 'foodId' is not present

I'm trying to get a food object by its foodId but I'm getting 400 error code saying Required String parameter 'foodId' is not present. Here is my controller class: package com.quickmeal.controller; import java.util.List; import…
0
votes
1 answer

Add an array of string to ProjectionOperation in MongoDB

I need to add the fields(get from ui) which need to be fetched using mongodb Aggregation, From uri i will get param as fields which has comma seperated string of fields http://foo.com?fields=id,name A document looks like: { "_id" :…
selva
  • 2,676
  • 3
  • 12
  • 11
0
votes
1 answer

Unable to fetch oauth2 access_token using "password" grant_type from MongoDB after upgrading to Spring Boot 2.0.0

I recently upgraded to Spring boot 2.0.0.RELEASE from 1.5.0.RELEASE, I am using Spring oAuth2 in my project and MongoDb for databases. After the upgrade, oAuth2 stopped working which I fixed by adding "oauth2-autoconfigure". I was able to get access…
0
votes
1 answer

Document field names can't start with '$' (Bad Key: '$3 Off Christmas Blend Coffee - 1 Lb+ Ground')

My Object list is like below. { "altText": "", "anchorText": "$3 Off Christmas Blend Coffee - 1 Lb. Ground", "anchorType": "href", "domainRating": 83, "externalLinks": 41, …
vemanna
  • 41
  • 1
  • 3
0
votes
1 answer

How to enable authentication for mongo db and connect with Spring Boot?

I am new to Mongo DB, and I didn't find any good resource/example for that. What I'd like to achieve is have a MongoDB running on my server, with authentication turned on. And a database for my application, with a user who can access the data. I…
0
votes
2 answers

return the last embeded data in a collection

In a spring-boot data mongodb application I whould like to return the last element of an embeded collection. My document is : @Document public class ConnectedObject { @Id private String uuid; private List measures = new…
BokC
  • 333
  • 5
  • 19
0
votes
1 answer

Not able to found declaration for mongo:mongo

This is spring-mongo.xml class while deploying I am getting some error. This is my XML.form this xml I am not able to create bean instance of MongoTemplate.
A.G
  • 489
  • 1
  • 6
  • 17
0
votes
1 answer

Mongo db query where condition for a column (list of values) having a value

I am trying to find a way to filter the records in Mongo db using Spring query. Here is the scenario, let's see I have an Activity entity/document. One of the fields is a list of names. I want to see if I can get all the records that the names field…
Laodao
  • 1,547
  • 3
  • 17
  • 39
0
votes
1 answer

When does Kotlin introspection become available in the lifetime of a Spring Boot Application?

I ran into a surprising bug. I am trying to make an application that would access mongodb using the repository pattern. In order to reduce code duplication I wanted to make a common base class for all repositories. The repository of each root…
Martin Drozdik
  • 12,742
  • 22
  • 81
  • 146
0
votes
1 answer

How to insert DBobject with TTL into MongoDB using Spring Java

I am new to MongoDB, I am trying to insert my db object using the below code, i am able to insert successfully but the DBobject is not removing after the given time it is still in db. Can any one give me example to insert the Dbobject correctly. …
jcoder
  • 23
  • 7
0
votes
2 answers

Return only one attribute in a mongodb query

@Query("{'recibido' : null ,'activo' : true}") public List findEmpleadosPrlActivoRecibidoIsNull(); I want you to return a list with the "employee_id" attribute of each object and not the whole object. Can somebody help me. Thank you.
Jose
  • 1,779
  • 4
  • 26
  • 50
0
votes
1 answer

Spring Data MongoDB - custom query

I want to store trace info like below: { "timestamp": 1394343677415, "info": { "method": "GET", "path": "/trace", "headers": { "request": { "Accept":…
user
  • 4,410
  • 16
  • 57
  • 83
0
votes
0 answers

Spring Data - mongodb unwind function does not give me correct result

I have 2 collections (articles & tags). Articles has 'tags' which is array of objectIds. I am trying to join articles and tags so as to get tagName from tags. Below is my mongodb query: db.articles.aggregate([ {"$unwind": "$tags"}, {"$lookup":…
user2869612
  • 607
  • 2
  • 10
  • 32