javascriptpythonnode.jsmongodbdatabase

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:

I want the database to be populated and modified from a script written in Python and to be queried from Node JS.

Is it possible? If yes, Does this approach have any kind of compatibility problems or inefficiencies?


Solution

  • 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.

    I would suggest using mongoose for Node.js and pymongo for python. You can easily install pymongo by doing - pip install pymongo in linux and osx systems. 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. You will find how to use it in many different language.

    Thanks!!