0

I'm trying to use LiteDB, I have the following:

var list2 = new List<Values>();

I've been looking at the LiteDB examples which is the following:

// Get customer collection
var col = db.GetCollection<Customer>("customers");

var customer = new Customer { Id = 1, Name = "John Doe" };

// Insert new customer document
col.Insert(customer);

// Update a document inside a collection
customer.Name = "Joana Doe";

col.Update(customer);

// Index document using a document property
col.EnsureIndex(x => x.Name);

Is there any way I can insert a list of type Values in my case it would be: var list2 = new List();

I can't seem to find anywhere that inserts this way.

Thanks,

losrob
  • 115
  • 1
  • 7
  • I dunno. Is there an overload on the collection's Insert method that takes an IEnumerable? What about a "BulkInsert" or similarly named method? Intellisense should tell you the answer. –  Jan 09 '18 at 15:42

1 Answers1

0

This worked for me!!

var col = db.GetCollection<Values>("customers");
col.Insert(list2);

Thanks,

losrob
  • 115
  • 1
  • 7