Open vshapenko opened 5 years ago
Hi @vshapenko, both changes was made to remove from user pottencial bad-use of BsonDocument
.
But if you need it in F# conversion, it's possible change this or maybe create another class like BsonValueWrapper
that contains access to this RawValue and implement ctor for Object
Sounds like a good idea.
пт, 11 окт. 2019 г., 16:01 Mauricio David notifications@github.com:
Hi @vshapenko https://github.com/vshapenko, both changes was made to remove from user pottencial bad-use of BsonDocument.
But if you need it in F# conversion, it's possible change this or maybe create another class like BsonValueWrapper that contains access to this RawValue and implement ctor for Object
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mbdavid/LiteDB/issues/1336?email_source=notifications&email_token=AEKNDOSUG2IS4BH62OTTYYLQOB2JLA5CNFSM4I7MKGOKYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEA75PHA#issuecomment-541054876, or unsubscribe https://github.com/notifications/unsubscribe-auth/AEKNDOR5JBXBVTUQN37YAOLQOB2JLANCNFSM4I7MKGOA .
The author of Mdbc is here. (Mdbc is the PowerShell wrapper of the official MongoDB C# driver).
I recently discovered LiteDB, found it fascinating, and I am now thinking (exploring?) the similar wrapper for LiteDB.
I must tell that LiteDB v5 API is PowerShell friendly right out of the box, at least comparing to the MongoDB C# driver v2. But there are numerous nuisances, not faults of the LiteDB design, just the PowerShell reality.
One of the nuisances is the mentioned absence of the public RawValue
of
BsonValue
. PowerShell would be very happy to get just object
. After all,
working with raw objects is what PowerShell does. But this not possible at the
moment. Extracting the real value is tedious, too difficult for such a basic
operation.
Using returned BsonValue
s in PowerShell is not a practical option. Even
though they sometimes behave "like real objects/values", the type is not
"native" and it should be unwrapped ASAP to avoid various issues.
both changes was made to remove from user pottencial bad-use of BsonDocument.
It sounds wise and cautious. But the reality is, these are needed in practice.
So people have to implement their own type switch conversion blocks to do
these (object
<-> BsonValue
) in every use case, with some pain and mistakes.
It might be better to expose this correct functionality, even if misuse is possible. What were the cases of misuse in practice?
Some thoughts on minimizing misuses of hopefully restored features.
BsonValue.RawValue
is already in a good shape, in my opinion. It is not implicit. If I type it, I get what I ask for, an object that I need for whatever reason raw. Please consider making it public.
BsonValue(object)
looks not quite right with its implicit nature. Then a static method with some proper unambiguous name would do the trick is a safe way. For example, Convert
, TryConvert
, or even both?
Hi @nightroman, I will check is it's possible make this public as get
only.... I'm planning to create a immutable version of BsonDocument/BsonArray so I need to check if this will not open a possible to be changed.
@mbdavid, thank you, I am looking forward to this or something else for object
<-> BsonValue
.
P.S. If I proceed with creating LiteDB module for PowerShell, I need to create the PowerShell friendly wrapper of BsonDocument
, namely IDictionary<string, object>
. It has to unwrap and wrap BsonValue
s internally. Input and output values must be object
in order to be PowerShell friendly.
Just in case, the MongoDB C# driver's BsonValue
exposes RawValue
as get
only and provides the static Create(object)
. I am not saying that LiteDB should follow. But the similar precedent exists.
Hi, my project (https://alemik.com/) is based entirely on RawValue and BsonValue(object). I am almost ready to release a new version 0,8 with many features. Please please please please consider to restore those features.
Hello! I am writing litedb wrapper for f#, and have some questions about upcoming v5 version of litedb.