-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Multiple points for the improvements #281
Comments
Hey @lmolotii - thanks for raising these issues!
That's actually the MongoDB C# driver, which MongoFramework sits on top of, doing that. I have the same concerns you have and I don't currently have a perfect strategy to solve it. Because of inheritance, Maybe if there was a way to describe that certain objects do not have inheritance at all, then you might be able to get away with it. Gets complicated if you use an interface as the type on the model but have varied concrete types too. A method to support migration could help but that adds a whole bunch of different complications. Alternatively, I thought about perhaps attributes that could specify type aliases so if you do change the name, you'd need to just specify what the old name was as an attribute (though this likely has the drawback of making the existing name off-limits indefinitely). But yeah, the type discriminators certainly have a few big issues:
What you want to do is set a name on the index. I show an example in the readme but I haven't really described what it does. Basically you can have the
I've been asked that question before and wrote a lengthy response about it here: #162 (comment) The only additional thing I'd add is to not be concerned about the implementation - whether it is disposes anything or not. The implementation could change at any point in the future and then be disposed. It being disposable now is effectively preventing that type of breaking change in the future.
While I've seen that issue before, I haven't encountered it for a while. As far as I can tell from doing a bit of research now, it seems to be by-design of how the connection strings work. The database in the connection string is used, by default, for authentication. This can, however, be overridden by specifying What makes this a little more confusing is that I currently use MongoDB Atlas for my own projects and I specify the database I want in the connection string - it doesn't have the same issue. That said, I have thought about having an |
Summary
Currently, MongoFramework is a nice tool for small projects, however, it still requires a lot of improvements.
Issue 1: _t value
When the persistence layer writes any document into the collection, MongoFramework introduces an additional field called "_t" with the name of the type. Something like:
_t: "LocationDocument"
In addition to that, it introduces the same field into each subdocument in the collection. I don't want to know what could happen if one of my software engineers will rename the document object class. Unfortunately, I found no options to disable this behavior.
Issue 2: Compound indexes
In our situation, we have two properties inside the document:
Each of the properties is represented as a collection of
Assignee
. If I set the [Index] property inside theAssignee
class, the framework will automatically create the following index:CompanyId
,Department.Watchers._id
,Department.Reviewers._id
I would rather have two separate indexes like instead of one mentioned above:
CompanyId
,Department.Watchers._id
CompanyId
,Department.Reviewers._id
Issue 3:
IMongoDbConnection
asIDisposable
Frankly, I don't understand why there is a need to have this structure as IDisposable if it doesn't use any disposable resources inside.
Issue 4: Database name as a part of a connection string cause
MongoDB.Driver.MongoAuthenticationException
If somebody would like to reproduce the error, they could do the following
Configure connection in the following way:
mongodb://root:password1234@localhost:27017/myservice-db
Run the application and observe the error:
I found the following workaround to fix it (basically I needed to implement my own IMongoDbConnection), here is the implementation sample:
Thanks for your great efforts to make the current MongoDB .Net environment a bit friendlier.
The text was updated successfully, but these errors were encountered: