Calling .toString() on object in generated query from projection

19 views
Skip to first unread message

Ivan Montilla

unread,
Nov 18, 2019, 7:24:28 AM11/18/19
to RavenDB - 2nd generation document database
From this query:

from business in session.Query<Business>()
orderby business.LegalName
select new ListModel.Business
{
    Name = business.LegalName,
    Document = business.Document.ToString(),
    Email = business.Email
}

I get this generated HQL:

from Businesses as business
order by LegalName
select {
    Name : business.LegalName,
    Document : business.Document.toString(), // <--- Notice this
    Email : business.Email
}

The result is I get "[Object object]" string.

Document is a C# class with custom converter, so calling .ToString() I expect to call .ToString() method of the document type, not be transformed into HQL. As I know, RavenDB store only JSON data, no prototypes, so method will not be translated (except map, reduce, substr, etc).

Is this the expected behaviour or is it a bug?

Grisha Kotler

unread,
Nov 18, 2019, 11:43:19 AM11/18/19
to rav...@googlegroups.com
Hi,

This doesn't work since the ToString() isn't known on the server.


--
You received this message because you are subscribed to the Google Groups "RavenDB - 2nd generation document database" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ravendb/a260ad88-b3b9-4bdc-8b93-01f14d67479e%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages