0 returned out of 6 total

19 views
Skip to first unread message

Jordan Whiteley

unread,
May 28, 2016, 10:56:44 AM5/28/16
to RavenDB - 2nd generation document database
Hey, new guy to ravendb so this could just be bad code, but here's the situation.

I've got 2 repositories, one for a data import, and one for read ops.  The integration test works (generally) like this

            using (var fileRepo = new FileUploadsRepository())
            {
                var rates = new List<Rate>
                {
                    new Rate {RiskCategory = "A+", LoanRate = 4.2M },
                    //...snip...
                    new Rate {RiskCategory = "F-, no banana", LoanRate = 48.2M },
                };
                fileRepo.ReplaceRates(rates);
            }

            using (var ratesRepo = new RatesRepository())
            {
                var rs = ratesRepo.GetRates();
                Assert.AreEqual(6, rs.Count);
            }

The code behind the file uploads repo is pretty simplistic

        public void ReplaceRates(List<Rate> items)
        {
            var staleItems = Session.Query<Rate>().ToList();
            staleItems.ForEach(i => Session.Delete(i));
            items.ForEach(i => Session.Store(i));
            Session.SaveChanges();
        }

The code behind the rates repository is similarly simplistic

        public List<Rate> GetRates()
        {
            return Session.Query<Rate>().ToList();
        }

The test fails with the message Expected 6, actual 0 results returned. I'd accept this as some sort of eventual consistency except the console log seems to indicate that there are indeed 6 items there to return and for some reason my code isn't asking for them correctly.

    Ouery: Tag:Rates
    Time: 1ms
    Index Raven/DocumentsByEntityName
    Results: 0 returned out of 6 total

(Screenshot of the result http://imgur.com/CAzeKuK )

Hopefully someone here can tell me what I'm doing wrong.  

Oren Eini (Ayende Rahien)

unread,
May 28, 2016, 11:07:36 AM5/28/16
to ravendb
The documents have been immediately deleted. The index takes a few ms to update, but we know we can filter those results because you deleted them, so we skip them/

Hibernating Rhinos Ltd  

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

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

 


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

Reply all
Reply to author
Forward
0 new messages