Details
-
New Feature
-
Resolution: Won't Fix
-
Minor - P4
-
None
-
3.6.3
-
None
Description
We started implementing the ORM that came with version 3.x.
We decorate our Pojos with a custom hash. We now use your ORM to convert the object to BsonDocuments, we then edit it, and then we use it with your MongoCollection.
I've got it all to work, but i'm disappointed that some methods do not accept 'raw' bson as a parameter (eg: insertOne and replaceOne).
I've got 2 work-a-rounds for this:
- Emulate these methods around with updateOne.
- Generic the MongoCollection to BsonDocument instead.
I much prefer if MongoCollection supports these method with Bson as a value, as update does.
For your reference, what I suggest is adding:
- MongoCollection<D>.insertOne(Bson document)
- MongoCollection<D>.replaceOne(Bson filter, Bson replacement)
etc.
Similar to updateOne(Bson filter, Bson update).
Looking through the code of MongoCollectionImpl, it seems internally the Pojo is rather quickly converted to Bson.