You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 23, 2024. It is now read-only.
Trying to implement a reporting API for multiple mongo databases with the same structure using mongorest...
Have tried to implement this using the mongoengine connect mechanism:
for mongoconfig in configmongos:
print "Connecting: "+mongoconfig["name"]
db.connect(
name = mongoconfig["name"],
host = mongoconfig["host"],
port = mongoconfig["port"],
db = mongoconfig["database"]
)
and then using a variable in my document class:
class Products(db.Document):
productName = db.StringField()
businessUnit = db.StringField()
brand = db.StringField()
subBrand = db.StringField()
franchise = db.StringField()
category = db.StringField()
subCategory = db.StringField()
meta = {'collection': 'products',"db_alias": selectedInstance}
But it seams that the db alias is always "default"
Any way to implement this?
The text was updated successfully, but these errors were encountered:
MongoEngine has the ability to connect to multiple databases, and then switch that database using an alias (see above), the issue is that the MongoRest always registers the connection as "default" alias. I will take a look at the code to see where this is being done, and perhaps I can come up with a patch to have MongoRest support multiple aliases....
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Trying to implement a reporting API for multiple mongo databases with the same structure using mongorest...
Have tried to implement this using the mongoengine connect mechanism:
and then using a variable in my document class:
class Products(db.Document):
productName = db.StringField()
businessUnit = db.StringField()
brand = db.StringField()
subBrand = db.StringField()
franchise = db.StringField()
category = db.StringField()
subCategory = db.StringField()
But it seams that the db alias is always "default"
Any way to implement this?
The text was updated successfully, but these errors were encountered: