AllDocs creates an auto index

28 views
Skip to first unread message

Derek den Haas

unread,
Feb 22, 2018, 10:05:01 AM2/22/18
to RavenDB - 2nd generation document database
So I wanted to select an item AND transform it (only one item):

Created a document AllDocs, which will be translated to @alldocs (conventions), though when doing:

_session.Query<AllDocs>().Select(a => a.Id == "Test") it's creating a:
Auto/AllDocs/ById()

Which for some reason on each reboot of the database (which is happening every hour...) reindexes itself... definition only includes Id()

Michael Yarichuk

unread,
Feb 22, 2018, 12:33:43 PM2/22/18
to RavenDB - 2nd generation document database
Hi,
I will take a look at this.
Can you show full code of this use-case? 

From what I see, "equals" in select is not supported in such use case. 
The following code generates this exception System.NotSupportedException: 'Could not understand expression: from AllDocs.Select(a => (a.Id == "foo/bar"))' 

                using (var session = store.OpenSession())
                {
                    session.Store(new AllDocs{ Name = "FooBar!!"},"foo/bar");
                    session.SaveChanges();
                }

                using (var session = store.OpenSession())
                {
                    var foo = session.Query<AllDocs>().Select(a => a.Id == "foo/bar");                    
                }

However, a transformer function should work. What happens if you try the following query syntax?

                    var foo = from doc in session.Query<AllDocs>()
                        let transformFunc = (Func<AllDocs, bool>)(a => a.Id == "foo/bar")
                        select new
                        {
                            IsId = transformFunc(doc)
                        };

--
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+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Best regards,

 

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Michael Yarichuk l RavenDB Core Team 

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 

RavenDB paving the way to "Data Made Simple"   http://ravendb.net/  

Michael Yarichuk

unread,
Feb 22, 2018, 12:34:13 PM2/22/18
to RavenDB - 2nd generation document database
Also, what build are you using?

Derek den Haas

unread,
Feb 22, 2018, 12:37:31 PM2/22/18
to RavenDB - 2nd generation document database
4.0.2 nightly of today

Op donderdag 22 februari 2018 18:34:13 UTC+1 schreef Michael Yarichuk:
To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+u...@googlegroups.com.

For more options, visit https://groups.google.com/d/optout.
--
Best regards,

 

Hibernating Rhinos Ltd  cid:image001.png@01CF95E2.8ED1B7D0

Michael Yarichuk l RavenDB Core Team 

Office: +972-4-622-7811 l Fax: +972-153-4-622-7811

 

RavenDB paving the way to "Data Made Simple"   http://ravendb.net/  

Derek den Haas

unread,
Feb 22, 2018, 12:38:04 PM2/22/18
to RavenDB - 2nd generation document database
P.s. I will create a UnitTest

Op donderdag 22 februari 2018 18:37:31 UTC+1 schreef Derek den Haas:

Oren Eini (Ayende Rahien)

unread,
Feb 25, 2018, 6:24:57 AM2/25/18
to ravendb
Thanks, a unit test will be very useful.

Hibernating Rhinos Ltd  

Oren Eini l CEO Mobile: + 972-52-548-6969

To unsubscribe from this group and stop receiving emails from it, send an email to ravendb+unsubscribe@googlegroups.com.

Derek den Haas

unread,
Feb 26, 2018, 4:58:43 AM2/26/18
to RavenDB - 2nd generation document database
FYI, I cannot get it replicated on a new database, and the older database which has this behavior (which is a month (maybe even 2) old and started to add this query 2~4 weeks ago) might only recover this index (at all times). Removing the index will add the index back within a minute. I thought this was because of a service we are running which will automatically regenerate this index, though, when appending this script (or any other that I'm testing) no index of this name is being created... So I guess it was triggered on an earlier version of RavenDB. When it reappears on the new database, I will try to replicate the issue, but for now I think it's working on clean databases on the latest version.

Op zondag 25 februari 2018 12:24:57 UTC+1 schreef Oren Eini:

Arkadiusz Palinski

unread,
Feb 26, 2018, 5:16:45 AM2/26/18
to rav...@googlegroups.com
Query like:

from AllDocs where id() == "test" (session.Query<AllDocs>().Where(x => x.Id == "test"))

doesn't require to create an auto index. The results will be returned directly from the documents storage using its internal index (very efficient).
Reply all
Reply to author
Forward
0 new messages