BulkInsert.Store has different serialization as ISession.Store

23 views
Skip to first unread message

Germán Fernández

unread,
Jan 11, 2018, 10:22:17 AM1/11/18
to RavenDB - 2nd generation document database
Hi,

RC 4.0.0-nightly-20180108-1600

When inserting via BulkInsert, the document created is slightly different from the same entity saved through ISession.Store(). What I've seen so far:

1) With BulkInsert.Store there's an additional Id property serialized in the document (with ISession Id property gets mapped to the document_id)
2) With BulkInsert.Store, IEnumerable<string> in the model leaks $type property in the stored json.

In my opinión, they both should yield identical json.

Regards.

Germán

public class Entity
{
   
public string Id { get; set; }
    pulibc
IEnumerable<string> Tags { get; set; } = new string[0];
}

var entity = new Entity { Id = "transactions/248738", Name = "Whatever", Tags = new string[] { "files/178996" } };


// With session.Store(entity);
// transactions/248738
{
   
"Name": "Whatever",
   
"Tags": [
       
"files/178996"
   
]
}

//With bulkInsert.Store(entity);
// transactions/248738

{
   
"Id": "transactions/248738",
   
"Name": "Whatever",
   
"Tags": {
       
"$type": "System.String[], System.Private.CoreLib",
       
"$values": [
           
"files/178996"
       
]
   
}
}



Oren Eini (Ayende Rahien)

unread,
Jan 11, 2018, 5:12:51 PM1/11/18
to ravendb

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

Reply all
Reply to author
Forward
0 new messages