Spring mongodb 指南针缺少创建的数据/集合 [英] Spring mongodb compass missing created data/collections

查看:26
本文介绍了Spring mongodb 指南针缺少创建的数据/集合的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用 spring 将我的数据保存到数据库中.

I Save my data to database using spring.

   @RepositoryRestResource(collectionResourceRel = "operators", path = "operators")
public interface OperatorsRepository extends MongoRepository<Operator, String> {
}

我有文件:

main\resources\application.properties

main\resources\application.properties

spring.data.mongodb.uri=mongodb://admin:password@myclusterurl/test?retryWrites=true&w=majority

在我的配置类中我使用:

In my config class I use:

@Bean
CommandLineRunner commandLineRunner(OperatorsRepository operatorsRepository){operatorsRepository.save(myobjToSave);}

一切正常,我使用 REST 获取数据保存的数据.但我的问题是,在 Compass mongodb 中,我看不到创建的集合和数据.为什么?使用 mongo shell 和 mongo atlas 是一样的.

Everything works fine, i get data saved data using REST. But my problem is that in compass mongodb I don't see created collections and data. Why? Using mongo shell and mongo atlas is the same.

推荐答案

试试这个

spring.data.mongodb.uri=mongodb://xxxxxxxxxxxxxxxxxxx
spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration

这篇关于Spring mongodb 指南针缺少创建的数据/集合的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆