简体   繁体   English

我可以使用Python和NodeJS中的相同MongoDB数据库吗?

[英]Can I use the same MongoDB database from Python and NodeJS

I would like to know if it would be possible to use MongoDB in the following way: 我想知道是否可以通过以下方式使用MongoDB:

I want the database to be populated and modified from a script written in Python and to be queried from Node JS. 我希望从用Python编写的脚本填充和修改数据库,并从Node JS查询。

Is it possible? 可能吗? If yes, Does this approach have any kind of compatibility problems or inefficiencies? 如果是,这种方法是否存在任何兼容性问题或效率低下?

Thank you in advance 先感谢您

Yup, it's possible unless you mess up with the schema. 是的,除非你搞砸了架构,否则它是可能的。 Cause mongo won't complain for different types of objects in the same collection. 因为mongo不会抱怨同一个集合中不同类型的对象。

I would suggest using mongoose for Node.js and pymongo for python. 我会建议使用猫鼬于Node.js和pymongo的蟒蛇。 You can easily install pymongo by doing - pip install pymongo in linux and osx systems. 您可以通过在Linux和osx系统中执行pip install pymongo轻松安装pymongo。 But for window I think u will have to do it manually from here . 但对于窗口我认为你必须从这里手动完成。

I think reading the documentation for each of them would give you a better idea. 我认为阅读每个文档会给你一个更好的主意。 You can also take a look at getting started with mongodb . 你也可以看一下mongodb入门 You will find how to use it in many different language. 您将找到如何在许多不同语言中使用它。

Thanks!! 谢谢!!

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

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