MongoDB的学习-安装与springboot的整合

mongoDB的学习:

1.mongodb 安装及使用

mongodb 安装及使用__mongodb安装使用

MongoDB社区下载

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-4uR9zPSq-1655092482405)(https://gitee.com/ljq4551/picgo/raw/master/20220613114232.png)]

配置环境变量,使在任意位置都可以执行bin下的exe程序

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-tim20p8E-1655092482407)(https://gitee.com/ljq4551/picgo/raw/master/20220613114226.png)]

配置完成后,这样就成功了。

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-JGnfMX6J-1655092482408)(https://gitee.com/ljq4551/picgo/raw/master/20220613115205.png)]

2.开始整合springboot+mongoDB

1.导入依赖


        <dependency>
            <groupId>org.springframework.bootgroupId>
            <artifactId>spring-boot-starter-data-mongodbartifactId>
        dependency>

2.添加mongodb配置yaml配置

[外链图片转存失败,源站可能有防盗链机制,建议将图片保存下来直接上传(img-LzGTY7Yo-1655092482408)(https://gitee.com/ljq4551/picgo/raw/master/20220613114213.png)]

  #mongodb配置
  
  spring:
  	data:
        mongodb:
          host: localhost
          port: 27017
          #      mongodb数据库名称
          database: monge_demo

3.新增实体类对应mongodb的集合进行关系映射

package com.ljquan.test.pojo.mongoDB;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.data.annotation.Id;

import java.util.Date;

/**
 * @className Article
 * @Description 文章  用于mongodb的测试
 * @Author ljquan
 * @Date 2022-06-10 11:39:02
 * @Version 1.0.0
 */
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class Article {
    /**
     * 文章id
     */
    @Id
    private Long id;

    /**
     * 用户ID
     */
    private Long userId;

    /**
     * 文章标题
     */
    private String title;

    /**
     * 文章内容
     */
    private String content;

    /**
     * 创建时间
     */
    private Date createTime;

    /**
     * 更新时间
     */
    private Date updateTime;

    /**
     * 点赞数量
     */
    private Long thumbUp;

    /**
     * 访客数量
     */
    private Long visits;

}

4.开始使用Mongodb和springboot整合

创建ArticleService接口

package com.ljquan.test.service.mongoDB;

import com.ljquan.test.pojo.mongoDB.Article;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @className ArticleService
 * @Description 服务条
 * @Author ljquan
 * @Date 2022-06-10 13:54:33
 * @Version 1.0.0
 */
@Service
public interface ArticleService {
    /**
     * 插入文章
     * 插入
     *
     * @param article 文章
     * @return int
     */
    int insertArticle(Article article);

    /**
     * 更新文章
     *
     * @param article 文章
     * @return int
     */
    int updateArticle(Article article);

    /**
     * 删除文章
     *
     * @param id id
     * @return int
     */
    int removeArticle(Long id);

    /**
     * 找到所有
     *
     * @param article 文章
     * @return {@code List
} */ List<Article> findAll(Article article); /** * 找到一个 * * @param article 文章 * @return {@code Article} */ Article findOne(Article article); /** * 找到喜欢 * * @param article 文章 * @return {@code List
} */ List<Article> findLike(Article article); /** * 找到更多 * * @param article 文章 * @return {@code List
} */ List<Article> findMore(Article article); }

创建实现类ArticleServiceImpl

package com.ljquan.test.service.mongoDB.impl;

import cn.hutool.core.date.DateUtil;
import com.ljquan.test.pojo.mongoDB.Article;
import com.ljquan.test.service.mongoDB.ArticleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.mongodb.core.MongoTemplate;
import org.springframework.data.mongodb.core.query.Criteria;
import org.springframework.data.mongodb.core.query.Query;
import org.springframework.data.mongodb.core.query.Update;
import org.springframework.stereotype.Service;

import java.time.LocalDateTime;
import java.util.List;
import java.util.regex.Pattern;

@Service
public class ArticleServiceImpl implements ArticleService {
    @Autowired
    MongoTemplate mongoTemplate;

    /**
     * 插入文章
     *
     * @param article 文章
     * @return int
     */
    @Override
    public int insertArticle(Article article) {
        try {
            article.setCreateTime(DateUtil.date());
            mongoTemplate.insert(article);
            return 1;
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
    }

    /**
     * 更新文章
     *
     * @param article 文章
     * @return int
     */
    @Override
    public int updateArticle(Article article) {
        //通过query根据id查询出对应对象,通过update对象进行修改
        Query query = new Query(Criteria.where("_id").is(article.getId()));
        //更改信息
        Update update = new Update().set("username", article.getTitle());
        try {
            mongoTemplate.updateFirst(query, update, Article.class);
            return 1;
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
    }
    /**
     * 删除文章
     *
     * @param id id
     * @return int
     */
    @Override
    public int removeArticle(Long id) {

        Query query = new Query(Criteria.where("_id").is(id));
        try {
            mongoTemplate.remove(query, Article.class);
            return 1;
        } catch (Exception e) {
            e.printStackTrace();
            return -1;
        }
    }
    /**
     * 找到所有
     *
     * @param article 文章
     * @return {@code List
} */ @Override public List<Article> findAll(Article article) { Query query = new Query(Criteria.where("_id").is(article.getId())); return mongoTemplate.findAll(Article.class, article.getTitle()); } @Override public Article findOne(Article article) { Query query = new Query(Criteria.where("_id").is(article.getId())); return mongoTemplate.findOne(query, Article.class); } /** * 模糊查询 * * @param article 文章 * @return {@code List
} */ @Override public List<Article> findLike(Article article) { //设置 Pattern pattern = Pattern.compile("^.*" + article.getContent().trim() + ".*$", Pattern.CASE_INSENSITIVE); Query query = new Query(Criteria.where("content").regex(pattern)); return mongoTemplate.find(query, Article.class); } /** * 找到更多 * * @param article 文章 * @return {@code List
} */ @Override public List<Article> findMore(Article article) { Query query = new Query(Criteria.where("content").is(article.getContent())); return mongoTemplate.find(query, Article.class); } }

这里是最重要的,调用了刚刚导入进来的依赖,然后调用里面的接口实现整合

@Autowired
MongoTemplate mongoTemplate;

5.测试

   @Autowired
    ArticleServiceImpl articleService;

 /**
     * 测试发现相似
     */
    @Test
    public void testFindLike() {
        Article build = Article.builder().content("7").build();
        List
like = articleService.findLike(build); System.out.println(like.size()); like.forEach(article -> { System.out.println(article.getContent()); } ); } /** * 测试插入文章 */ @Test public void testInsertArticle() { Article build = Article.builder() .content("7") .id(snowflake.nextId()) .createTime(DateUtil.date()) .thumbUp(9L) .updateTime(DateUtil.date()) .build(); int i = articleService.insertArticle(build); log.info("【article】= {} 插入成功", JSONUtil.toJsonStr(build)); } /** * 测试发现所有 */ @Test public void testFindAll() { List
all = articleService.findAll(); log.info(all + " "); } ……

6.MongoDB数据库输出结果

2022-06-13 11:29:53.704 [main] INFO  org.mongodb.driver.connection - Opened connection [connectionId{localValue:3, serverValue:15}] to localhost:27017
2022-06-13 11:29:53.781 [main] INFO  com.ljquan.test.TestApplicationTests - [Article(id=1, userId=1535106423837560832, title=wwigzpxj10u8hda1zs8l更新之后的标题, content=mmcxzb9ookzl6jegxnrp53hicmo0t6onch0mcwlqpk6s2kqzpgie0pqrcb2ps9v3ut40ypqwht9kgwj6fjovpc3bmt2j8vx5qpmtud9uxslp04pe0oy9etu4018xe9xe7nl7t2bmojkj9nre6m8odj, createTime=Fri Jun 10 11:47:47 CST 2022, updateTime=Fri Jun 10 13:36:59 CST 2022, thumbUp=0, visits=0), Article(id=1535134388424151040, userId=1535134388424151041, title=ok94ysuekznpuwmi7puo, content=vvbfxw4mn0538vso42aktg6botfn17ro8bc0z58byb0mk22wfimbxcpgo273m7bzj6qs31kamu8p777kze6sarj8feywu1i77332ajauatu2rmi1aj96zmaukpqug6ovskws4xfq6wfrh8m3ut3iig, createTime=Fri Jun 10 13:38:54 CST 2022, updateTime=Fri Jun 10 13:38:54 CST 2022, thumbUp=0, visits=0), Article(id=1535134388495454208, userId=1535134388495454209, title=wqy8byd12n8p2pekl26n, content=bbzvqheql3qpwk9b6ju2r59srzekpvy4q2qglpxuyzc70nclfwulhzxmuqugoof7xx3jpfzhy1kkvklg9mqd6gqmqub39vht7fz9mf7ncwot3uazfzcgvuvm3icii3o5zcizlufrep6z9jau4likvb, createTime=Fri Jun 10 13:38:54 CST 2022, updateTime=Fri Jun 10 13:38:54 CST 2022, thumbUp=0, visits=0), Article(id=1535134388495454210, userId=1535134388495454211, title=bgpu1j0cmkswc02c3ghl, content=g8s6hf1wwipxg59ygqezn0h0e9wbynw2ju1ad3b4dd71188gaqu01oohbdhj4rchukf25gl8x4jiw2jhxtrkbexxobmvcn70lcos12gdzyrjmbkhxcruxdvectx0gpaxvnf3fjuwu28udyzo69q7nl, createTime=Fri Jun 10 13:38:54 CST 2022, updateTime=Fri Jun 10 13:38:54 CST 2022, thumbUp=0, visits=0), Article(id=1535134388495454212, userId=1535134388495454213, title=co8khj1kh4dw8fw1oxht, content=2b2ta1w52olvaavmvhmtlsgynkeux8ps87h64sjqmdy6eud0l5zh81yihtegegsvwxkbp5pamcldmwynrdiswfli75z4lcau5v210mxjlmat78rdloqsqfobwhr1f5cxo0217c7g8mqzeglzklf0rf, createTime=Fri Jun 10 13:38:54 CST 2022, updateTime=Fri Jun 10 13:38:54 CST 2022, thumbUp=0, visits=0), Article(id=1535134388495454214, userId=1535134388495454215, title=qp0cvb1rzfafoxscnbgr, content=rdhw4ys2mwsfzaa0vzdp7p1ufs1tk29yypdsiwvbnx7j2pglkljlkerd1myamiqr2r3o858qjjxzhra94073xft66ynri3up3nwhut9o4zkkkdtvz5nfmsyzb4usqr3e4u66ym2fhfuvczwbrz181p, createTime=Fri Jun 10 13:38:54 CST 2022, updateTime=Fri Jun 10 13:38:54 CST 2022, thumbUp=0, visits=0), Article(id=1535134388495454216, userId=1535134388495454217, title=gdykjbb6hipcsdkukdza, content=1616z4cpwq4cse7q19qj1ft7j3vegn03b2mfmrsjseylh8mv1qc3ntybiebb40ifubx8yr4muxlkvjb8dwi08flplg97mi63a95zxmq3rfam4lc5ckub6cih1cui9mse8qn28jbm3mtvu5ewv5xcd0, createTime=Fri Jun 10 13:38:54 CST 2022, updateTime=Fri Jun 10 13:38:54 CST 2022, thumbUp=0, visits=0), Article(id=1535134388495454218, userId=1535134388495454219, title=sbybn8n133q9ahh6hys4, content=z6zpdwvegw0o8txuo5ze1un316qulemjgvodctl0rkea40y0wfccf19nfmxqgk2w1ivfg0rzu11zot1hmhx08dqxpzsrwxts26oglz8mf4ojeupuqryiqohfyvnu5eg4uni4pklxrmmuzowi9net64, createTime=Fri Jun 10 13:38:54 CST 2022, updateTime=Fri Jun 10 13:38:54 CST 2022, thumbUp=0, visits=0), Article(id=1535134388495454220, userId=1535134388495454221, title=mo77ot1lnqnmjf37sh1u, content=mnm8w3fkh2gu1mabhlqw2jaobs7p5p171w5c1218khsjxk5o5dwg76hdgddhrpa54ht5mjth1e4hhof3p9wem9pfn9ehkn2pr0gvc647wq2f4h5fw0lwm5y1n67yif9aru652r8qjq2hfsldqr0pci, createTime=Fri Jun 10 13:38:54 CST 2022, updateTime=Fri Jun 10 13:38:54 CST 2022, thumbUp=0, visits=0), Article(id=1535134388495454222, userId=1535134388495454223, title=nepwd773h61rl2ygz354, content=zsw3kj1t6qsubxrp7wv9vl3e9ox8ueiyl1pt54z3o6y3gn7owakgqhz5n46jaa8i2tzt9467g4g6zrg3qxo3370kzqxgenub2xsptf6zjla3cykqoap82gg1cdnaik01npqj5pl9rsawbw6kx7xqz9, createTime=Fri Jun 10 13:38:54 CST 2022, updateTime=Fri Jun 10 13:38:54 CST 2022, thumbUp=0, visits=0), Article(id=1535134388495454224, userId=1535134388495454225, title=j647o22eewc0pyykfazg, content=q358f95wc252ggqjdrwpttle4o7xr4zx76askzcvedf3hv7t40ddknpxnomzkuhmmykvnqhloi9fsl7gxkl19b45hnsnd7ltb3td3ghcnh0bpx2a4wagcyhwniug5lgynqi3q0nq0b1ujgoi1zfz11, createTime=Fri Jun 10 13:38:54 CST 2022, updateTime=Fri Jun 10 13:38:54 CST 2022, thumbUp=0, visits=0), Article(id=1535135113699004416, userId=1535135113699004417, title=9wewx985ayf6m9ny4fbj标题0, content=4dqumthlfqjunoi26gc5sl2r57lasvae9vmsugl5eevau9mi1hicu0kanhmauh972o8bsixs8vmgmq7embcjgx79ys6q7e5utknya5jl2pnb715w15v88d5rf0mfkey8gzzq9p1nvi1j9s8e8evfyq内容0, createTime=Fri Jun 10 13:41:47 CST 2022, updateTime=Fri Jun 10 13:41:47 CST 2022, thumbUp=0, visits=0), Article(id=1535135113787084800, userId=1535135113787084801, title=4ko0ffg21ymplfnza7zw标题1, content=wwe94h9tplhiyg9inrrxeexinnb821ai80uxlmyyml1ipvwbwcf444buqfxluzpj5wkz969optqty6y7eup5ggx8h19ewq7mk6bnt14mlbq4zputac137rebqwq3af7rt4apeh61i8306760wydau9内容1, createTime=Fri Jun 10 13:41:47 CST 2022, updateTime=Fri Jun 10 13:41:47 CST 2022, thumbUp=0, visits=0), Article(id=1535135113787084802, userId=1535135113787084803, title=xoqmm0z43rj9f6fwvsnw标题2, content=rgadlme0y9baqtc19i2nmzvlgaq10xmh4aeqv47b3olsv0qqidzyfm6hcidu9gfebg4rokck5z5i5rmr91fpx2ihpefhmwl8zdb3zk6bxixuxh1xuxad0w7to7wvs0z1mc71udz1rcl9efq2kbkuea内容2, createTime=Fri Jun 10 13:41:47 CST 2022, updateTime=Fri Jun 10 13:41:47 CST 2022, thumbUp=0, visits=0), Article(id=1535135113787084804, userId=1535135113787084805, title=xk0efgub8c6ujki0otkn标题3, content=wizywv8pi4q99o2f7m5vyqoi574lg45wwevf4wzmwtz839r0h0dwzib71plqdy8nehw7wvgxjpq2ps1v9d91cqi9e1bkwfyr13i37jty6ttvtyzoip0baxp9rjxcyb2n28x0jz74dbffl3if26hi39内容3, createTime=Fri Jun 10 13:41:47 CST 2022, updateTime=Fri Jun 10 13:41:47 CST 2022, thumbUp=0, visits=0), Article(id=1535135113787084806, userId=1535135113787084807, title=5k6j5d2bm1z8ktakv98f标题4, content=j14aje94frhy84c7vbvdscehull4pxl3cejedyh0iex1lg79qzuf26tovjdfaxn1xus0vcivetqd2p2vscrqy1tuwu293cqnhcf5tme7wujlkufjb3mtbfxiw3on9r0saeg274j42hxbxzoq9wkoi6内容4, createTime=Fri Jun 10 13:41:47 CST 2022, updateTime=Fri Jun 10 13:41:47 CST 2022, thumbUp=0, visits=0), Article(id=1535135113787084808, userId=1535135113787084809, title=drjloecdia10f89yf0bj标题5, content=hwk9op2lohgn11axe4e27l2rdzrakmedvqi70hwssyec5ecjskpah8wzdgax9wopsu6xdwx7jxw9oebeat5esejgsl3f63bwbhg6yjhdx2e3vgnixhfb9snkqwg3l427cygiy8suqqyeg639kctki1内容5, createTime=Fri Jun 10 13:41:47 CST 2022, updateTime=Fri Jun 10 13:41:47 CST 2022, thumbUp=0, visits=0), Article(id=1535135113787084810, userId=1535135113787084811, title=hykpbq08iucw62qe90vz标题6, content=dhwanhbjbj8vtwqhpcaxfyzd487kbhw0lsuzibme1agsx6wh5rvlr9pv0347psadxw9g2f74d7wnuacij4vaj6n5531j7xrg28cizfcc5juqcrvwxkfh1tucoafgbkm13wqeqnjw6vihmmruebfji9内容6, createTime=Fri Jun 10 13:41:47 CST 2022, updateTime=Fri Jun 10 13:41:47 CST 2022, thumbUp=0, visits=0), Article(id=1535135113787084812, userId=1535135113787084813, title=xkmt7no0llcww587sg7z标题7, content=0yy9dg1uq2wks4oceuiggvmj950dvn73ffruc7z4ohylv5zqgxlky1irf8vmwvyi1w5zmapmx9a0h7uxy1eo7cm3iyiheahi9cpw3u2jbjtf91datmmcvd325mcm6p7ndva3asu1bzk0qo2fgnyaf2内容7, createTime=Fri Jun 10 13:41:47 CST 2022, updateTime=Fri Jun 10 13:41:47 CST 2022, thumbUp=0, visits=0), Article(id=1535135113791279104, userId=1535135113791279105, title=kusc9cob7u4wldss849e标题8, content=cskyol7l4it2dausbxjy3tbe40lholas2vckkh29fs9e93i3jf3t01yhbbp19iyh0kmbc294i2xybkdcjjakfvvogn3arz8nc0iwxk0o0k7nphgyigytfsca6030vwq3c1o3tyjgax3dqcnl9ibewv内容8, createTime=Fri Jun 10 13:41:47 CST 2022, updateTime=Fri Jun 10 13:41:47 CST 2022, thumbUp=0, visits=0), Article(id=1535135113791279106, userId=1535135113791279107, title=12aog9fkgvinqk6brivt标题9, content=1iisqm3yriflg5kg5f79aknqdi5g38cfdsux1jkarhsfmx79zfhtb4sanyfalncg13b5tcg82xsj302klr3ag1vnxxx42u6wiru0g5zjovvko7bhp3txztxn9vw6qcii2fhi8id49lkqvl7iuenvv1内容9, createTime=Fri Jun 10 13:41:47 CST 2022, updateTime=Fri Jun 10 13:41:47 CST 2022, thumbUp=0, visits=0), Article(id=1535147409540255744, userId=1535147409540255745, title=lzbcd5h23bovjeekc3aj标题0, content=fd03rrmz25dv78izytrlqr5ex42dwx8mcmwlcisagfwyjk24q7ck0oj6uftkxsimrd8lnob5kshb9qst9ngit5f5h9a96fqe5d190z4x0x0j4c3gafkhqnbm2fscxa8ykkswzd1i25wzeeb64xduyq内容0, createTime=Fri Jun 10 14:30:38 CST 2022, updateTime=Fri Jun 10 14:30:38 CST 2022, thumbUp=0, visits=0), Article(id=1535147409800302592, userId=1535147409800302593, title=0zmll09h0np7ebuhbbgm标题1, content=ia0lkj89ollsa9jk8iy5nximyf4mmv4ta29x8v4pp53l41w9xdvzdqkkitxdh0ocmr76ss0flnhdi2mgvg6h0edmnla55j3oenj303dmjo1zdbhr8iy5n1i54t4credl58ifay26tq0lgt366seohy内容1, createTime=Fri Jun 10 14:30:38 CST 2022, updateTime=Fri Jun 10 14:30:38 CST 2022, thumbUp=0, visits=0), Article(id=1535147409800302594, userId=1535147409800302595, title=krqsivtn3ezbljn1ecse标题2, content=ulp3rt7g5la07xt50arhsddshzsob290paw2lm9lwwfp7bwzz3ajhv5nrbedq452p5yiiyddbh96hiruwtbdsdkwxaf2obykb1sm116ffw280da7f5pnq5neip0vqci9czqdzsijd5gq2t4w98g9zv内容2, createTime=Fri Jun 10 14:30:38 CST 2022, updateTime=Fri Jun 10 14:30:38 CST 2022, thumbUp=0, visits=0), Article(id=1535147409804496896, userId=1535147409804496897, title=qog3zvzjruxjl3n8vp4d标题3, content=xafsxhnw0yudv8txg6pces5akx5epinablnchdqkgxwhuhvajhojhhc1elbhzlsf220ga542mm9it5jrgy8st86k2eujhepggg0d51m5paaejtzy71iuvcjwlmcoiwhquwztc6zcxc62h9upw2a2fw内容3, createTime=Fri Jun 10 14:30:38 CST 2022, updateTime=Fri Jun 10 14:30:38 CST 2022, thumbUp=0, visits=0), Article(id=1535147409804496898, userId=1535147409804496899, title=9wdbupzqfw9e1v809u8f标题4, content=m4obw0g22aj4v0looa5pjhvmo539ldh734so3sagesplvx0etemgf24athenl5jvhyvzhfh70ynm640qqxqx6gbgv6uoifx7ei75z1qz283193a0hzyytl42xt86d9vg60l38o4xb15964ccggbere内容4, createTime=Fri Jun 10 14:30:38 CST 2022, updateTime=Fri Jun 10 14:30:38 CST 2022, thumbUp=0, visits=0), Article(id=1535147409804496900, userId=1535147409804496901, title=l1mo6o3ebf8bulgyglk6标题5, content=gz3i7vmj4mcqpsl2usn542kv9g25mscio6p0q6rxgs0mztfocx1gswa3xgcsh3a4qtlygemalgn1cfex1xbij2j6kic8gfqkfy8ynzep3fv8sp6gn1eovtst2jlkxgdcdbv2cff6bzmgcuqwnppaxn内容5, createTime=Fri Jun 10 14:30:38 CST 2022, updateTime=Fri Jun 10 14:30:38 CST 2022, thumbUp=0, visits=0), Article(id=1535147409804496902, userId=1535147409804496903, title=9p9hivqn1vypkauuifp9标题6, content=uhf1msezlyito1v8jzwd9cd1x0mph2tz1kp5nbf5rzhidsvm3ggjvjru57201myqzvo7riw81rfj8h9ax3ce4pd9buoi9ftfs162vx42jlajz5mfj4kdc2gi6bobubxdse6ge0987sow86o9cjirth内容6, createTime=Fri Jun 10 14:30:38 CST 2022, updateTime=Fri Jun 10 14:30:38 CST 2022, thumbUp=0, visits=0), Article(id=1535147409804496904, userId=1535147409804496905, title=96i2msjasakx8p7yhcmu标题7, content=fgkc093lfwqhp4pl35fp0oonb6npyro0qnkbn0pa02ovryfswb83i3q21ld06taeymal4e7nfn7x5jfb4pn0bb43wox4x5muc4rsxgw2vz20ds43fdfl6gax3xl8dr41g7ykmhgbpagibb9miqv5le内容7, createTime=Fri Jun 10 14:30:38 CST 2022, updateTime=Fri Jun 10 14:30:38 CST 2022, thumbUp=0, visits=0), Article(id=1535147409804496906, userId=1535147409804496907, title=maedrpi7y15r7duryf5t标题8, content=hkit4crgrjuc2pqo9w4iq6twjdqf4525a30x6du40i1pzzogimrexns4t6b1tw0txc5r9ztg0k348n2vskant3t2uq0n87bl5eh0t0s2wjk55zaohix6frklpa7g9glvwq2k5wf7j3fh4unvb89fpq内容8, createTime=Fri Jun 10 14:30:38 CST 2022, updateTime=Fri Jun 10 14:30:38 CST 2022, thumbUp=0, visits=0), Article(id=1535147409804496908, userId=1535147409804496909, title=l1457qtsca6mqbrtzqha标题9, content=x8twi3jl5d8zbqxibtbt3vd143772mhjby4sf0m78g4lpkd8fa2pbo40t000v7yzdm3pvbzxwyouxr5ld5wvzsusw3dadjppc87oft7ggmq2tfbly0zj0pbdymt0op0xcg337c552hemq2imoir6so内容9, createTime=Fri Jun 10 14:30:38 CST 2022, updateTime=Fri Jun 10 14:30:38 CST 2022, thumbUp=0, visits=0), Article(id=1535171979651452928, userId=null, title=null, content=7, createTime=Fri Jun 10 16:08:16 CST 2022, updateTime=Fri Jun 10 16:08:16 CST 2022, thumbUp=9, visits=null), Article(id=1535175023524974592, userId=null, title=null, content=7, createTime=Fri Jun 10 16:20:22 CST 2022, updateTime=Fri Jun 10 16:20:22 CST 2022, thumbUp=9, visits=null), Article(id=1535175698518511616, userId=null, title=null, content=7, createTime=Fri Jun 10 16:23:03 CST 2022, updateTime=Fri Jun 10 16:23:03 CST 2022, thumbUp=9, visits=null), Article(id=1536184056574775296, userId=null, title=null, content=7, createTime=Mon Jun 13 11:09:54 CST 2022, updateTime=Mon Jun 13 11:09:54 CST 2022, thumbUp=9, visits=null)] 

16:20:22 CST 2022, thumbUp=9, visits=null), Article(id=1535175698518511616, userId=null, title=null, content=7, createTime=Fri Jun 10 16:23:03 CST 2022, updateTime=Fri Jun 10 16:23:03 CST 2022, thumbUp=9, visits=null), Article(id=1536184056574775296, userId=null, title=null, content=7, createTime=Mon Jun 13 11:09:54 CST 2022, updateTime=Mon Jun 13 11:09:54 CST 2022, thumbUp=9, visits=null)]


以上是把mongodb数据库的信息输出出来,测试结束。

你可能感兴趣的:(#,SpringBoot,mongodb,spring,boot,学习)