简体   繁体   English

是否可以将后台脚本连接到mongoDB服务器? 如果是,如何?

[英]Is it possible to connect your background script to mongoDB server? If Yes, How?

I am creating a google chrome extension. 我正在创建一个Google Chrome扩展程序。 I have a background script from which I want to send and retrieve some data from MongoDB database. 我有一个后台脚本,我想从该脚本发送和检索MongoDB数据库中的一些数据。 How do I do that? 我怎么做? I'm new in chrome extension development. 我是chrome扩展程序开发的新手。

YES. 是。 It's possible. 这是可能的。 But, It's not a good idea to expose a database to the public internet at all. 但是,根本不向公共互联网公开数据库是个好主意。 Implement a REST like method in your backend code and authorize calls to it using some web standard auth scheme, such as OAuth or HTTP Basic auth. 在您的后端代码中实现类似REST的方法,并使用某些网络标准身份验证方案(例如OAuth或HTTP Basic身份验证)授权对其的调用。 Hitting the DB directly is way too dangerous. 直接击中数据库太危险了。 You can receive/send data from DB accordingly. 您可以相应地从DB接收/发送数据。 Saying That if you still want to go ahead here's a link to help you with that For full REST capabilities, consider using an external REST Interface such as Sleepy.Mongoose . 说,如果您仍然想要继续,那么这里有一个链接可以帮助您实现这一点。要获得完整的REST功能,请考虑使用外部REST接口,例如Sleepy.Mongoose

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

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