Unable to perform join in mongodb using a package and code specified in https://pypi.org/project/mongojoin/

Unable to execute $lookup in mongodb. I need to perform join in mongodb using python but the code and package specified in https://pypi.org/project/mongojoin/ is not working. Also can $lookup be run from mongoshell then how?

I am using the following code:

    from mongojoin.mongojoin import MongoJoin, MongoCollection
    c = MongoCollection("test","c",["name", "add", "prod_id"], {prod_id : "123456"})
    p = MongoCollection("test","p",[ "prod_id", "pname", "pcost",], {prod_id : "123456"})
    aggregator = MongoJoin(c, p, ["prod_id"])
    result = aggregator.inner()
    print(result)

Getting the following error:

    Traceback (most recent call last):
      File "E:\nm21\jd1.py", line 1, in <module>
        from mongojoin.mongojoin import MongoJoin, MongoCollection
      File "C:\Python\Python39\lib\site-packages\mongojoin\mongojoin.py", line 10, in <module>
        from processdata import CollectionsProcessedData
    ModuleNotFoundError: No module named 'processdata'


Read more here: https://stackoverflow.com/questions/64872133/unable-to-perform-join-in-mongodb-using-a-package-and-code-specified-in-https

Content Attribution

This content was originally published by sps at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: