Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
Deserialize an IEnumerable<BsonDocument> into an IEnumerable<NominalType>
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  4 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Alex Brown  
View profile  
 More options Jul 9 2012, 8:22 am
From: Alex Brown <a...@alexjamesbrown.com>
Date: Mon, 9 Jul 2012 05:22:43 -0700 (PDT)
Local: Mon, Jul 9 2012 8:22 am
Subject: Deserialize an IEnumerable<BsonDocument> into an IEnumerable<NominalType>

Is it possible to use the BsonSerializer to Deserialize an
IEnumerable<BsonDocument> into an IEnumerable<NominalType>?

Currently it seems I have to do something nasty like:

var result = new List<Discipline>();

            foreach (var item in bsonDocs)

result  .Add(BsonSerializer.Deserialize<MyNominalType>(item));

            return results;


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Stam  
View profile  
 More options Jul 9 2012, 9:16 am
From: Robert Stam <rob...@10gen.com>
Date: Mon, 9 Jul 2012 09:16:18 -0400
Local: Mon, Jul 9 2012 9:16 am
Subject: Re: [mongodb-csharp] Deserialize an IEnumerable<BsonDocument> into an IEnumerable<NominalType>

See response to the same question in the mongodb-user group.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Alex Brown  
View profile   Translate to Translated (View Original)
 More options Jul 9 2012, 9:18 am
From: Alex Brown <a...@alexjamesbrown.com>
Date: Mon, 9 Jul 2012 14:18:45 +0100
Local: Mon, Jul 9 2012 9:18 am
Subject: Re: [mongodb-csharp] Deserialize an IEnumerable<BsonDocument> into an IEnumerable<NominalType>

Thanks..
Had deleted that post due to this group (mongodb-csharp) being the right
place for it...
not sure if posts can be moved across groups?

anyway, thanks again

On 9 July 2012 14:16, Robert Stam <rob...@10gen.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Robert Stam  
View profile   Translate to Translated (View Original)
 More options Jul 9 2012, 9:23 am
From: Robert Stam <rob...@10gen.com>
Date: Mon, 9 Jul 2012 09:23:07 -0400
Local: Mon, Jul 9 2012 9:23 am
Subject: Re: [mongodb-csharp] Deserialize an IEnumerable<BsonDocument> into an IEnumerable<NominalType>

I didn't realize you had deleted the post. I responded by email, which may
have resurrected the post.

In any case, here's what I replied in mongodb-user:

===== original reply in mongodb-user =====
BsonSerialize.Deserialize is designed to deserialize a single document at a
time.

However, you could write your conversion from IEnumerable<BsonDocument> to
IEnumerable<NominalType> on a single line of code:

    return bsonDocs.Select(b =>
BsonSerializer.Deserialize<MyNominalType>(b));

which is essentially doing the same thing but using the LINQ Select method.
=====


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »