ravendb

Finding objects which contains at least one element from subset using RavenDB and LINQ

点点圈 提交于 2019-12-23 20:32:42
问题 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>() {"a"} }; var q2 = new Question("q2") { Tags = new List<string>() {"b"} }; var q3 = new Question("q3") { Tags = new List<string>() {"a", "b", "c"} }; var q4 = new Question("q4") { Tags =

How to properly create a Map/Reduce Index for RavenDB in C#

白昼怎懂夜的黑 提交于 2019-12-23 16:50:21
问题 I'm working on an app that uses RavenDB on the back end. It's my first time using Raven, and I'm struggling with Map/Reduce. I have been reading the doc's, but unfortunately I'm not getting anywhere in the process. Basically I have thousands of documents like this. { ..... "Severity": { "Code": 6, "Data": "Info" }, "Facility": { "Code": 16, "Data": "Local Use 0 (local0)" }, ..... } And out of it, I need to make a single query with output that looks like this. {"Severity": [ {"Emergency":0}, {

ravendb combining Search with Where

白昼怎懂夜的黑 提交于 2019-12-23 15:26:41
问题 I am executing a raven query in C#, and utilising both the Where() and Search() extension methods. I need both these functionalities, because I need to only return indices with a specific Guid field, AND text that exists in a body of text. Unfortunatly, the Where extension method seems to not be compatible with the Search extension method. When I combine them I get a Lucene query like this: Query: FeedOwner:25eb541c\-b04a\-4f08\-b468\-65714f259ac2 MessageBody:<<request*>> Which seems to

The data file size do not shrink down when delete from ravendb

独自空忆成欢 提交于 2019-12-23 09:50:06
问题 I used the following code to delete documents from RavenDB. At the bottom of Raven UI, I can see the number of documents decrease from 3,000,000 to 2,000,000. But the size of the "Data" file does not shrink down. It is always about 100G. store.DatabaseCommands.DeleteByIndex("Sagas/ByStarted", new IndexQuery { Query = "Started:{00010101000000 TO 20130101000000}", }); Server Build #960, Client Build #960 Please help ... 回答1: That is by design. We don't give out space back to the OS by default.

What do I need to do to store objects in RavenDB?

大兔子大兔子 提交于 2019-12-23 07:38:21
问题 I'm using ravendb to serialize an object and test it through mstest. I am getting this result: System.ArgumentException: Object serialized to String. RavenJObject instance expected. Here is my code public class Store { private static IDocumentStore store = createStore(); private static EmbeddableDocumentStore createStore() { var returnStore = new EmbeddableDocumentStore(); returnStore.DataDirectory = @"./PersistedData"; returnStore.Initialize(); return returnStore; } public static void Write

A resource manager with the same identifier is already registered with the specified transaction coordinator

混江龙づ霸主 提交于 2019-12-23 06:15:22
问题 I am consistently getting ResourceManager error. I use below code: public static IDocumentStore Initialize() { const string id = "2a5434cf-56f6-4b33-9661-5b6cc53bd9a5"; _instance = new DocumentStore { Url = "http://localhost:8085", DefaultDatabase = "Testing", ResourceManagerId = new Guid(id) }; _instance.Initialize(); return _instance; } Here's the call stack: 2015-06-04 15:39:08.366 INFO NServiceBus.Unicast.Transport.TransportReceiver Failed to process message System.Runtime.InteropServices

How to make RavenDB DocumentStore available to calling APIs

◇◆丶佛笑我妖孽 提交于 2019-12-23 04:53:25
问题 I have an MVC4 application using RavenDB as a datastore. The application has MVC/Web, Domain, Data, and Security layers. I am writing custom membership and role providers that need to initialize the database and access the DocumentStore. I'm writing these class from the Security layer, and would like to use a singleton DocumentStore (set in the application), but I can't figure out how to access it. Other, examples I see of writing custom providers for RavenDB create new DocumentStore

How to construct a proper WHERE clause with RavenDb

旧时模样 提交于 2019-12-23 04:19:31
问题 I have experimented with 2 forms of the call, this one products = DocumentSession.Query<Product>() .Statistics(out stats) .Where(p => p.INFO2.StartsWith(term1)) .Where(p => p.INFO2.StartsWith(term2)) .Where(p => p.INFO2.StartsWith(term3)) .OrderByField(columnToSortBy, columnToSortByAsc) .Skip(pageIndex * pageSize) .Take(pageSize) .ToList() ; and this way products = DocumentSession.Query<Product>() .Statistics(out stats) .Where(p => p.INFO2.StartsWith(term1) & p.INFO2.StartsWith(term2) & p

How to index related documents in reverse direction in Ravendb

狂风中的少年 提交于 2019-12-23 01:36:12
问题 In Example II of Indexing Related Documents, an index is built over Authors by Name and Book title. The relevant entities look like so: public class Book { public string Id { get; set; } public string Name { get; set; } } public class Author { public string Id { get; set; } public string Name { get; set; } public IList<string> BookIds { get; set; } } I.e. only the Author holds information about the relation. This information is used in constructing said index. But how would I construct an

RavenDB: Why do I get null-values for fields in this multi-map/reduce index?

蹲街弑〆低调 提交于 2019-12-22 18:09:28
问题 Inspired by Ayende's article https://ayende.com/blog/89089/ravendb-multi-maps-reduce-indexes, I have the following index, that works as such: public class Posts_WithViewCountByUser : AbstractMultiMapIndexCreationTask<Posts_WithViewCountByUser.Result> { public Posts_WithViewCountByUser() { AddMap<Post>(posts => from p in posts select new { ViewedByUserId = (string) null, ViewCount = 0, Id = p.Id, PostTitle = p.PostTitle, }); AddMap<PostView>(postViews => from postView in postViews select new {