Questions tagged [litedb]

Use this tag for questions about LiteDB, which is a a free, open-source, embedded NoSQL database for .NET available via nuget or direct download.

LiteDB is a free, open-source, embedded NoSQL database for .NET inspired by MongoDB. Because it is a serverless document store, LiteDB can be "installed" via NuGet or by copying a dll into your project's bin folder.

Resources

Related Tags

183 questions
13
votes
3 answers

LiteDB: Invalid BSON data type 'Null' on field '_id'

Using LiteDB, and it is amazing. It works well for loading and storing data, however, not on subsequent loads after the database has been created. On initial load, everything is perfect. It creates the database and stores the new record flawlessly,…
Kraang Prime
  • 9,981
  • 10
  • 58
  • 124
11
votes
5 answers

How to see stored data in LiteDB-NoSQL

I am learning LiteDB - NoSQL. I have go through the basic example. When I build it, it will generate Data Base File. Now, I just want to read this file to see the data I have stored. Is is possible to read it like we can see the data in MSSQL? How…
Ankita
  • 1,416
  • 4
  • 17
  • 42
6
votes
1 answer

Getting data from LiteDB

I wonder how I console.writeline data stored in my litedb database file. This is my POCO Class [BsonId] public int Id { get; set; } public DateTime Updated { get; set; } public DateTime Last { get; set; } public override string ToString() { …
Veotani
  • 85
  • 1
  • 5
5
votes
1 answer

Entity framework data provider for LiteDB

I want my entity framework Dbcontext class to work with different -2 databases. It is working fine with SQL Server, MySql, SQLite using respective data providers. But unable to get any data provider for LiteDB(no-sql).Is there any article or sample…
Vikas
  • 63
  • 1
  • 7
4
votes
2 answers

DateTimeOffset: TZ Offset is reset to +00:00 when fetching data from LiteDb collection

When inserting, the offset is OK, however when retrieving the document, it's resetting to +00:00 Property: public DateTimeOffset CreatedOn { get; set; } Insert: user.CreatedOn = DateTimeOffset.Now; // 01/20/2021 6:05:21 PM…
4
votes
0 answers

LiteDB BsonExpression: is there any method returning true?

I am quite new to LiteDB. In my attempts to create a more or less complex query using a combination of partial comparisons along different fields conjugated by the logical 'and' I am using the LiteDB's Query.And() method, like // This is what I am…
Alex Konnen
  • 717
  • 6
  • 20
4
votes
3 answers

LiteDB 5 System.IO.IOException: The process cannot access the file

We currently have a client application which consists of a Windows Service and a WPF application, both utilising LiteDB and targeting .Net Framework 4.8. The windows service runs under the local system account and the WPF app runs under the user's…
Daniel
  • 369
  • 1
  • 4
  • 19
4
votes
1 answer

LiteDB Find() with DateTime.Year comparison doesn't have any result

When using LiteCollection's instance method Find(), I passed a predicate into it as a parameter. This is the Find() method: stus.Find(s => s.Birthday.Year <= 1996);, and full code here: Student.cs: public class Student { public ObjectId ID {…
namhnz
  • 75
  • 1
  • 10
4
votes
1 answer

Do you use EnsureIndex() only once, or for evey document you insert into the database?

I'm learning how to use LiteDB. Here's a bit of C# code I use to insert a .Net object into the database: // Create new YacksProjectInfo object and insert it into the database YacksProjectInfo projectInfo = new…
RenniePet
  • 11,420
  • 7
  • 80
  • 106
4
votes
2 answers

Get all elements from Lists inside a List

I have following data model: public class Customer { [BsonId] public int CustomerId { get; set; } public string Name { get; set; } } public class Order { [BsonId] public int OrderId { get;…
h0ch5tr4355
  • 2,092
  • 4
  • 28
  • 51
3
votes
0 answers

Litedb : Convert string to BsonDocument and vice-versa

When i convert bson to string using the following : var stringDoc = LiteDB.JsonSerializer.Serialize(bsonDocument); i'm getting the following : {"_id":{"$oid":"62f3c9299c37811224131269"},"Name":"John Doe","Phone":"0778636316"} When i try to convert…
Ahmed HM
  • 110
  • 1
  • 9
3
votes
0 answers

Where to put an embedded database in an AspNet Core application

I have lately re-discovered embedded databases such as Sqlite (sql, relational) and LiteDb (noSql) and I like working with them for small web apps or mobile apps. However, I cannot find any good answer to where to place them. Where to put them…
diegosasw
  • 13,734
  • 16
  • 95
  • 159
3
votes
1 answer

Convert string into LiteDB BsonDocument

I have a string in JSON format, and I want to convert it into a BSONDocument for insertion into a LiteDB database. How do I do the conversion? I'm using LiteDB 5.0.0-beta ( I also tested it in LiteDB v4.1.4 ). Here is the code; MyHolder holder = new…
Lost_In_Library
  • 3,265
  • 6
  • 38
  • 70
3
votes
2 answers

How to check if LiteDB database file has password or not in C#?

I have a number of LiteDB database files. Some of them have password. when I open these files in the application, for those one which have password I will get the Invalid database password exception. How I can check the database file before opened…
Parham.D
  • 1,158
  • 2
  • 12
  • 31
3
votes
2 answers

How to properly implement an interface that was designed for async usage?

Starting with the following (simplified) interface which has async/await in mind, I want to implement it by using LiteDB database. public interface IDataService { Task GetUserAsync(int key); } Unfortunately, LiteDB currently does not…
Stephan
  • 1,791
  • 1
  • 27
  • 51
1
2 3
12 13