简体   繁体   English

使用多个 mongodb 数据库并根据 url 进行动态调用

[英]Using multiple mongodb databases and having dynamic calls based on url

I am not sure if should i create multiple databases or not.我不确定是否应该创建多个数据库。 But I think multiple db would create better data.但我认为多个数据库会创建更好的数据。 So I want to create a app, where users can post the link for a particular concept and other users can upvote/downvote it.所以我想创建一个应用程序,用户可以在其中发布特定概念的链接,其他用户可以对其投赞成票/反对票。 like /react/useState /javascript/optionalChaning像 /react/useState /javascript/optionalChaning

so here users can post a link(blog, article) for useState concept.所以用户可以在这里发布 useState 概念的链接(博客,文章)。 I want, if I hit /react/useState then it should go in react database and go in useState collection and show me all the documents available.我想,如果我点击 /react/useState,那么它应该在 React 数据库中为 go,在 useState 集合中为 go,并向我显示所有可用的文档。 It can be /react/useRef meaning → react database and useRef collection.可以是 /react/useRef 意思 → react 数据库和 useRef 集合。

same for /javascript/optionalChaning → javascript database and optionalChaining collection and return all documents inside it. /javascript/optionalChaning → javascript 数据库和 optionalChaining 集合相同,并返回其中的所有文档。

How can I achieve this using multiple databases我怎样才能使用多个数据库来实现这个

/[database]/[collection]/[documented]
/react/useState
/react/useRef/3246276782634

go to that particular db then go into that particular collection? go 到那个特定的数据库然后 go 到那个特定的集合?

mongodb forum url - https://www.mongodb.com/community/forums/t/using-multiple-db-in-one-project/211383?u=akshay_shinde mongodb 论坛 url - https://www.mongodb.com/community/forums/t/using-multiple-db-in-one-project/211383?u=akshay_shinde

I am totally clueless, going with only one database will solve it, but i want to scale it for all the topics/languages/frameworks.我完全一无所知,只使用一个数据库就可以解决它,但我想针对所有主题/语言/框架扩展它。 So having seperate db will might solve it.所以拥有单独的数据库可能会解决它。

I don't see any reason to use multiples databases.我看不出有任何理由使用多个数据库。 I suggest you, for your usecase, to review your projects and maybe have a look to neo4j which can be a good friend for what you want to achieve:-)我建议您,对于您的用例,审查您的项目,也许看看 neo4j,它可以成为您想要实现的目标的好朋友:-)

https://neo4j.com/ https://neo4j.com/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM