ravendb

Entity Collection Property is Empty when Loading from RavenDB

被刻印的时光 ゝ 提交于 2019-12-10 15:25:15
问题 I started using RavenDB today. When I save a class, I can see the Collection property in the DB: However, when I load the class, the collection has no items in it: public IEnumerable<CustomVariableGroup> GetAll() { using (IDocumentSession session = Database.OpenSession()) { IEnumerable<CustomVariableGroup> groups = session.Query<CustomVariableGroup>(); return groups; } } Is there some type of activation depth that needs to be set in order to see the properties that are POCOs? Edit (to show

Find all items where child collection doesn't contain an item

。_饼干妹妹 提交于 2019-12-10 14:57:34
问题 Given: public class Order { public string Name {get;set;} public List<LineItem> LineItems {get; set;} } public class LineItem { public string Product {get; set;} public int Quantity {get; set;} } I'm trying to figure out how to construct a query that will return all the Orders that don't have a LineItem with a Product called "Apple" 回答1: I've been thinking about this for awhile. It's come up a few times. The problem is that Raven doesn't currently handle !.Any() or .All() queries. This

How to model football game statistics in RavenDB

懵懂的女人 提交于 2019-12-10 12:08:39
问题 I'm new to RavenDB and I'm still trying to get my head around the best way to model the data for the current scenario. Here is what the data looks like. Game - Teams - Team 1 - list of players - Team 2 - list of players - Events - Event 1 - type: Pass - teamId - PlayerId - Event 2 - type: Goal - teamId - PlayerId At the beginning of each game we get the overall info for the game (e.g. Teams, Venue etc) and then every few minutes we get an updated list of events. Also I need to be able to

Filter a static RavenDB map/reduce index

可紊 提交于 2019-12-10 11:19:14
问题 Scenario/Context Raven 2.0 on RavenHQ Web app, so async is preferred My application is a survey application. Each Survey has an array of Questions ; and conversely, each Submission (an individual's response to a survey) has an array of Answers . I have a static index that aggregates all answers so that I can display a chart based on the responses (e.g. for each question on each survey, how many people selected each option). These data are used to render, for example, a pie chart. This

RavenDB does not play nicely with Transaction Scope

懵懂的女人 提交于 2019-12-10 10:59:19
问题 I have the following test case that i expect to pass. But it does not pass with RavenDB. If i create the exact same test with MsSql, it does pass. var connectionString = "Url=http://localhost:8080"; var store = new DocumentStore(); store.ParseConnectionString(connectionString); store.Initialize(); using (var scope = new TransactionScope()) using (var session = store.OpenSession()) { session.Store(dog); session.SaveChanges(); var dogs = session.Query<Dog>().Customize(x => x

How to synchronize changes in nosql db (ravendb)

南楼画角 提交于 2019-12-10 10:19:55
问题 I've started learning NoSQL on an example of RavenDB. I've started with a simplest model, let's say we have topics that were created by users: public class Topic { public string Id { get; protected set; } public string Title { get; set; } public string Text { get; set; } public DenormalizedUser User { get; set; } } public class DenormalizedUser { public string Id { get; set; } public string Name { get; set; } } public class User { public string Id { get; protected set; } public string Name {

Finding objects which contains at least all elements from subset using RavenDB and LINQ

自古美人都是妖i 提交于 2019-12-10 07:49:48
问题 I have simple type Question : public class Question { public Question(string id) { Id = id; Tags = new List<string>(); } public string Id { get; private set; } public IList<string> Tags { get; set; } } I have defined sample collection of such questions: var q1 = new Question("q1") { Tags = new List<string>() {"aa", "bb"} }; var q2 = new Question("q2") { Tags = new List<string>() {"aa"} }; var q3 = new Question("q3") { Tags = new List<string>() {"aa", "bb", "cc"} }; var q4 = new Question("q4")

RavenDB - Planning for scalability

雨燕双飞 提交于 2019-12-10 03:36:12
问题 I have been learning RavenDB recently and would like to put it to use. I was wondering what advice or suggestions people had around building the system in a way that is ready to scale, specifically sharding the data across servers, but that can start on a single server and only grow as needed. Is it advisable, or even possible, to create multiple databases on a single instance and implement sharding across them. Then to scale it would simply be a matter of spreading these databases across the

RavenDB throws casting exception after models namespace change

﹥>﹥吖頭↗ 提交于 2019-12-10 02:14:17
问题 In the database, I have already stored hundreds of documents. Now the system architecture has changed and (among others) models was migrated into different namespace (in different assembly). Below, metadata of sample document is shown: and code I'm using to fetch such document: var configuration = documentSession.Load<One.Social.Core.Entities.Setting>("Setting"); which throws casting exception: [InvalidCastException: Unable to cast object of type 'One.QA.Core.Entities.Setting' to type 'One

RavenDb with ASP.NET MVC 3 - How to generate URL with ID?

三世轮回 提交于 2019-12-10 01:45:25
问题 This is probably a very simple answer, but i'm new to RavenDb, so i'm obviously missing something. I've got a basic object with the default convention for id: public string Id { get; set; } When i save it to the document store, i see it gets a value of like: posts/123 Which is fine, but...how do i generate a URL like this: www.mysite.com/edit/123 If i do this: @Html.ActionLink("Edit", "Posts", new { id = @Model.Id }) It will generate the followiung URL: www.mysite.com/edit/posts/123 Which is