Closed AlexHedley closed 5 years ago
DumpableBsonDocument is more or less a Dictionary<string,object>
so you can go with something like:
AllComment.Where(_ => _["_id"] == "00000000-0000-0000-0000-000000000000")
or better (as you actually use LiteDB engine):
AllComments.FindOne("00000000-0000-0000-0000-000000000000")
Thanks for the reply,
Unfortunately the Where
returns (0 items)
but at least it's not getting the error anymore,
FindOne
The name 'AllComments' does not exist in the current context
ok mine was just pseudo code, I suppose the issue is with the Guid type (I guess you used that type for the id).
Please try with something like:
AllComment.Where(_ => _["_id"] == Guid.Parse("00000000-0000-0000-0000-000000000000"))
and (Comments instead of All)
Comments.FindOne(Guid.Parse("00000000-0000-0000-0000-000000000000"))
Please note that All
Where
The call is ambiguous between the following methods or properties: 'LiteDB.BsonValue.operator ==(LiteDB.BsonValue, LiteDB.BsonValue)' and 'System.Guid.operator ==(System.Guid, System.Guid)'
FindOne
Cannot execute text selection: The best overloaded method match for 'LiteDB.LiteCollection
.FindOne(LiteDB.Query)' has some invalid arguments Argument 1: cannot convert from 'System.Guid' to 'LiteDB.Query'
Errors seem pretty self-explaining...
Have you tried some tests? like:
AllComments.Where(_ => (Guid)_["UniqueId"] == Guid.Parse("00000000-0000-0000-0000-000000000000"))
or
Comments.FindOne(Query.EQ("UniqueId", Guid.Parse("00000000-0000-0000-0000-000000000000")))
Comment.FindOne(Query.EQ("_id", Guid.Parse("00000000-0000-0000-0000-000000000000")))
Found the record, Thanks
I can successfully connect to my db. The Tables are listed and I can view content, for example:
AllComment.Take (100)
Returns a Results table ofIEnumerable<DumpableBsonDocument>
If I try
AllComment.Where (a => a._id == '00000000-0000-0000-0000-000000000000')
I've added the References to the
dll
that contains theComment
class. I've added the Namespace.Is there anything else I need to add?