spring-data-mongodb

storing a scanned (pdf,tiff,jpeg) file in MongoDB .

你离开我真会死。 提交于 2020-02-21 04:54:48
问题 I have to store a tiff(tag image file format) or pdf scanned file in mongodb that should be Text search able . like if we want to search "on base of text" it should be able to search . I am going to use .net mvc or java with mongodb . so how can i store this pdf file and then can retrieve from database . any suggestion will be appreciated . thanks 回答1: You can store files by using MongoDb GridFs as described in this question and extract texts from a PDF file by using some features those

Please use 'MongoMappingContext#setAutoIndexCreation(boolean)' or override 'MongoConfigurationSupport#autoIndexCreation()' to be explicit

这一生的挚爱 提交于 2020-02-15 06:32:07
问题 I went through https://docs.spring.io/spring-data/mongodb/docs/2.2.0.RC1/reference/html/#mapping-usage and other sources on the web, but the solution did not worked for me. I am using Spring Boot 2.2.2.RELEASE and Spring Data Mongo . In this example, at Model/Pojo field level We're using @Indexed(name = AppConstants.FIRSTNAME_INDEX, direction = IndexDirection.ASCENDING) private String firstName; Error: Please use 'MongoMappingContext#setAutoIndexCreation(boolean)' or override

Please use 'MongoMappingContext#setAutoIndexCreation(boolean)' or override 'MongoConfigurationSupport#autoIndexCreation()' to be explicit

我们两清 提交于 2020-02-15 06:30:26
问题 I went through https://docs.spring.io/spring-data/mongodb/docs/2.2.0.RC1/reference/html/#mapping-usage and other sources on the web, but the solution did not worked for me. I am using Spring Boot 2.2.2.RELEASE and Spring Data Mongo . In this example, at Model/Pojo field level We're using @Indexed(name = AppConstants.FIRSTNAME_INDEX, direction = IndexDirection.ASCENDING) private String firstName; Error: Please use 'MongoMappingContext#setAutoIndexCreation(boolean)' or override

Please use 'MongoMappingContext#setAutoIndexCreation(boolean)' or override 'MongoConfigurationSupport#autoIndexCreation()' to be explicit

余生颓废 提交于 2020-02-15 06:29:27
问题 I went through https://docs.spring.io/spring-data/mongodb/docs/2.2.0.RC1/reference/html/#mapping-usage and other sources on the web, but the solution did not worked for me. I am using Spring Boot 2.2.2.RELEASE and Spring Data Mongo . In this example, at Model/Pojo field level We're using @Indexed(name = AppConstants.FIRSTNAME_INDEX, direction = IndexDirection.ASCENDING) private String firstName; Error: Please use 'MongoMappingContext#setAutoIndexCreation(boolean)' or override

CodecConfigurationException when saving ZonedDateTime to MongoDB with Spring Boot >= 2.0.1.RELEASE

拟墨画扇 提交于 2020-01-28 10:34:15
问题 I was able to reproduce my problem with a minimal modification of the official Spring Boot guide for Accessing Data with MongoDB, see https://github.com/thokrae/spring-data-mongo-zoneddatetime. After adding a java.time.ZonedDateTime field to the Customer class, running the example code from the guide fails with a CodecConfigurationException: Customer.java: public String lastName; public ZonedDateTime created; public Customer() { output: ... Caused by: org.bson.codecs.configuration

How to fix mongo index creation after update to Srping Boot 2.2?

走远了吗. 提交于 2020-01-24 22:07:55
问题 On the previous version of Spring Boot (2.1.9) everything worked fine. I'd updated it to 2.2.2.RELEASE (with dependency management plugin used), and have started to get an error: org.springframework.dao.DataIntegrityViolationException: Cannot create index for '' in collection 'testDTO' with keys 'Document{{_id=1, version=1}}' and options 'Document{{name=optimistic_concurrency_idx}}'.; nested exception is com.mongodb.MongoCommandException: Command failed with error 67 (CannotCreateIndex):

SpringData Mongo @Column equivalent annotation (@Property?)

≯℡__Kan透↙ 提交于 2020-01-24 03:07:38
问题 Is there a SpringData Mongo equivalent of the JPA @Column annotation? Basically, I've got a POJO with a property that I want to store in Mongo with a different name. So, the following object: public class Pojo{ @Property("bar") private String foo = "Hello World"; } would be persisted as: { "_class":"com.example.Pojo", "bar" : "Hello World" } Note: I don't want to use the MappingMongoConverter to explicitly do it 回答1: The Spring Data reference documentation lists @Field as the annotation to

Create Spring Data Aggregation from MongoDb aggregation query

一世执手 提交于 2020-01-23 02:38:09
问题 Can any one help me convert this mongoDB aggregation to spring data mongo? I am trying to get list of un-reminded attendee's email in each invitation document. Got it working in mongo shell, but need to do it in Spring data mongo. My shell query db.invitation.aggregate( [ { $match : {_id : {$in : [id1,id2,...]}}}, { $unwind : "$attendees" }, { $match : { "attendees.reminded" : false}}, { $project : {_id : 1,"attendees.contact.email" : 1}}, { $group : { _id : "$_id", emails : { $push : "

MongoRepository @Query Failed to parse string as a date

∥☆過路亽.° 提交于 2020-01-15 12:15:37
问题 First of all, my issue is searching Collecttions in MongoDB via Spring JPA (MongoRepository). My Object: { "_id" : ObjectId("5c78e1f447f39c2eacb229d7"), "lab" : "xxx", "type" : "Holiday", "description" : "Lunar New Year", "start_date" : ISODate("2019-02-04T02:37:42.152Z"), "end_date" : ISODate("2019-02-08T06:37:42.152Z"), "all_day" : true, "_class" : "xxx.Event" } i can do as my wish in Mongo query as: db.getCollection('event').find({"start_date" : {$gte :ISODate( "2019-02-03T02:37:42.152Z")

Does Spring Data MongoDB support enums?

徘徊边缘 提交于 2020-01-14 07:17:06
问题 For Java enum type, I learn that there are two solutions for MongoDB: serialization and using Jackson’s ObjectMapper. Can the MongoRepository work with an enum data type with either of those approaches or I have to write a customized repository? 回答1: Yes, Spring Data MongoDB supports enums. Just use them in your domain model. 回答2: Spring Data Mongodb can serialize enum into string using enum's name as value. Let's say, it uses the second approach from the article http://www.vineetmanohar.com