Emmanuel Leblond

Results 177 comments of Emmanuel Leblond

`switch_db` is just a way to change the default db alias to use (a db alias is a name leading to a `pymongo.MongoClient`). So given you create a new connection...

mongoengine disconnect does two things: - calling `close` on the `pymongo.Mongoclient` connection - `del` the closed connection object to release it associate memory Based on this, I think you should...

First thing, you should not define your database name like (i.e. `connect('statsnba')`), this is an old way of doing pre-pymongo 2.0 and [doesn't work anymore](https://github.com/MongoEngine/mongoengine/blob/master/mongoengine/connection.py#L112) (see 83e3c5c7d8545d5ced30ce679fef800aeecbd60c). So basically doing...

Can you replace `connect` and `disconnect` with `db = MongoClient().statsnba` and `db.close(); del db` (and of course commenting your `Document.save` calls). Basically using pymongo instead of mongoengine to see if...

@AlJohri 1. I think the documentation is outdated about `connect` [the `connect` signature](https://github.com/MongoEngine/mongoengine/blob/master/mongoengine/connection.py#L178) takes `db` then `alias` as params. Then `db` is [passed to register_connection](https://github.com/MongoEngine/mongoengine/blob/master/mongoengine/connection.py#L50) and stored as `conn_settings.name`. However...

Hi, Have you profiled the execution with `Profile/cProfile` ? A graph of it with `objgraph` should give us a better view of where the trouble is.

@sauravshah I started investigating this issue and planned to release a fix for this If you cannot wait, the trouble is in the [Document initialization](https://github.com/MongoEngine/mongoengine/blob/master/mongoengine/base/document.py#L82) where a class is created...

@sauravshah sorry I had a branch ready but forget to issue a PR, here it is: #1630, can you have a look on it ? Considering #298, I've tried numerous...

> is it possible to take the class to be referenced as a kwarg on ReferenceField and solve this issue? Not sure what you mean... We could add `__getattr__`/`__setattr__` methods...

The trouble `B` maybe have children classes,: ```python class B(Document): meta= {'allow_inheritance': True} class Bchild(B): pass class A(Document): b = ReferenceField(B) b_child = Bchild().save() a = A(b=b_child).save() ``` In this...