Re: Re: .NET driver and raw bson data

From: Robert Stam <robert@xxxxxxxxxxx>
To: "mongodb-user@xxxxxxxxxxxxxxxx" <mongodb-user@xxxxxxxxxxxxxxxx>
Date: Thu, 5 May 2016 15:11:59 -0400
Why ads?
A collection of <BsonDocument> should work as well... I tried it on my
machine and it did work:

    var client = new MongoClient("mongodb://localhost");
    var database = client.GetDatabase("test");
    var collection = database.GetCollection<BsonDocument>("test");

    var document = new BsonDocument { { "_id", 1 }, { "x", 0 } };
    var bytes = document.ToBson();
    var rawDocument = new RawBsonDocument(bytes);

    database.DropCollection("test");
    collection.InsertOne(rawDocument);



On Wed, May 4, 2016 at 6:43 AM, Andreas Vilinski <andreas.vilinski@xxxxxxxxx
wrote:

Oh, thanks!

my try was:

var collection = db.GetCollection<BsonDocument>("collection_name");

collection of BsonDocument, but tried to insert RawBsonDocument, which
compiled but didn't work

Am Dienstag, 3. Mai 2016 22:48:38 UTC+2 schrieb Craig Wilson:

It should be as simple as using

var collection = db.GetCollection<RawBsonDocument>("collection_name");
var doc = new RawBsonDocument(bytes);

collection.InsertOne(doc);

Perhaps you could let us know what you tried and the error you received.
Craig

On Tuesday, May 3, 2016 at 3:36:43 PM UTC-5, Andreas Vilinski wrote:

Hi,

i would like insert data structures already serialized to bson byte
array (with FsPickler)
Can't figure out myself whether it is possible with current .NET driver.
There is RawBsonDocument class, however i was not able to make insert
with it.

Can you help?


--
You received this message because you are subscribed to the Google Groups
"mongodb-user"
group.

For other MongoDB technical support options, see:
https://docs.mongodb.org/manual/support/
---
You received this message because you are subscribed to the Google Groups
"mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an
email to mongodb-user+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to mongodb-user@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit
https://groups.google.com/d/msgid/mongodb-user/8c73dbc6-9049-4d95-99f3-744bfef6f842%40googlegroups.com
<https://groups.google.com/d/msgid/mongodb-user/8c73dbc6-9049-4d95-99f3-744bfef6f842%40googlegroups.com?utm_medium=email&utm_source=footer>
.

For more options, visit https://groups.google.com/d/optout.


-- 
You received this message because you are subscribed to the Google Groups "mongodb-user"
group.

For other MongoDB technical support options, see: https://docs.mongodb.org/manual/support/
--- 
You received this message because you are subscribed to the Google Groups "mongodb-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mongodb-user+unsubscribe@xxxxxxxxxxxxxxxx.
To post to this group, send email to mongodb-user@xxxxxxxxxxxxxxxx.
Visit this group at https://groups.google.com/group/mongodb-user.
To view this discussion on the web visit https://groups.google.com/d/msgid/mongodb-user/CAJCJWG0gGOQYXmghewtSUO1fLhuy_j_2yWYXjm1vhXTqjkocBg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Why ads?