System.InvalidOperationException??

4,198 views
Skip to first unread message

itsik_a

unread,
Oct 26, 2011, 5:08:58 AM10/26/11
to mongodb-csharp
Hi, I hope it's not too general but In which scenarios can i get:
System.InvalidOperationException: ReadStartDocument can only be called
when CurrentBsonType is Document, not when CurrentBsonType is String

Daniel Harman

unread,
Oct 26, 2011, 7:49:16 AM10/26/11
to mongodb...@googlegroups.com

The driver serializes to a stream with tokens embedded to identify the object type that follows. Read start is expecting the first token to indicate a document not a string.

You could get this situation when you are trying to deserialize a fragment as a document.

Dan

Daniel Harman

unread,
Oct 26, 2011, 7:59:45 AM10/26/11
to mongodb...@googlegroups.com
Hi,

Are there any projects that create "QueryComplete"s using fluent syntax? I dabble with fluentmongo a little but don't think this offers this functionality. It would be handy though for when one needs a query as part of an update.

Dan

itsik_a

unread,
Oct 26, 2011, 11:07:35 AM10/26/11
to mongodb-csharp
No there aren't. I'm using only
.MongoDB.Bson.dll
.MongoDB.Drivers.dll
it's happening when i'm trying to add new field to already exist
document
but sometime i get this error without any change in the document

i guess that if there is a syntax problem i will get this error every
compilation, but sometimes i'm getting error and ..sometimes i'm not

Robert Stam

unread,
Oct 26, 2011, 11:14:24 AM10/26/11
to mongodb-csharp
Can you show a bit of the code involved and the stack trace?

My guess is that you are deserializing a document to a class and the
document has data that doesn't match the declaration of the class. In
which case it would also be helpful to show us the declaration of the
class and the existing document (use findOne in the mongo shell to
display the value of the existing document).

Daniel Harman

unread,
Oct 26, 2011, 4:04:33 PM10/26/11
to mongodb...@googlegroups.com

Hi Robert,

Is there a reason the QueryBuilder doesn't seem to take into account the IdMemberConvention? e.g. I have lots of Id fields that the driver maps to _id on serialisation, but I have to remember to use _id in Query.EQ("_id", xxx) etc...


Dan

Daniel Harman

unread,
Oct 29, 2011, 10:14:03 AM10/29/11
to mongodb...@googlegroups.com

Is there anything more to matching an objectid as a string than it being any alpha/numeric string of 24 characters?

I'm using them in URLs so would like to tighten up the matching a bit. Thinking I might also add a checksum when they are exposed externally...

Dan

Robert Stam

unread,
Oct 29, 2011, 10:29:17 AM10/29/11
to mongodb-csharp
It can't be just any string, it has to be 24 hexadecimal characters.

Any 24 hexadecimal characters will Parse correctly to an ObjectId.
Assuming these 24 hexadecimal characters came from an ObjectId in the
first place, there is nothing to consider.

You could do *some* post Parse validation if you wanted to, but
probably not necessary. You could check the Timestamp component to see
that it isn't unreasonably distant in the past or future. There's not
much you can do to validate the MachineId, Pid and Increment
components.

Since you are probably going to use the ObjectId to lookup something,
I think the lookup itself is all the validation you need.

Daniel Harman

unread,
Oct 29, 2011, 11:49:37 AM10/29/11
to mongodb...@googlegroups.com

Hi Robert,

The reason I was asking is that the URL routing mechanism can consider a regex (and possibly more if I extend it hence checksum thoughts), which gives me more flexibility if I can identify an object Id. e.g. if I can filter by this then these two urls can go to different targets:

www.mysite.com/Members/h3hi312i123uh213u123ew23

vs

www.mysite.com/Members/Dave

Not such a great example, but gives an idea what I'm thinking...

Given that it's hex I guess I can consider re-encoding to use full char set etc and maybe inserting some hyphens etc if I want it to be more matchable for URLs.

Thanks for the help,

Dan

Robert Stam

unread,
Oct 29, 2011, 6:36:45 PM10/29/11
to mongodb-csharp
You can match a 24 digit hex string even without dashes. Use something
like:

/[0-9a-f]{24}/

itsik_a

unread,
Oct 31, 2011, 11:51:19 AM10/31/11
to mongodb-csharp
var query = new QueryDocument("Value.MessageId", messageId);
DoDatabaseOperation(() =>
{
bool success = false;
int retries = 0;
do
{
var matches = _Collection.Find(query);
if (matches.Size() == 0)
throw new Exception("Trying to add state to
non-existing message");
foreach (var match in matches)
{
// Sleep before next attempt
if (retries > 0)
System.Threading.Thread.Sleep(500);

var oldMatch = match.Clone();

match.Value.CreateNextState(messageState.State,
messageState.RecipientId, messageState.IsFinal);
var state =
match.Value.MessageState.FindCurrentState(messageState.RecipientId);
if (state == null)
throw new Exception("Trying to add state
to non-existing recipient");
state.InitTime = messageState.InitTime;
state.Tag = messageState.Tag;
match.RefreshMessageStateHistory();
var queryDocument = new
QueryDocument(oldMatch.ToBsonDocument());
var updateDocument = new
UpdateDocument(match.ToBsonDocument());

var result = _Collection.Update(queryDocument,
updateDocument);
success = result.DocumentsAffected == 1;
_Collection.Save(match);
retries++;
}
} while (!success && retries <
MongoDBDeclarations.MaxUpdateRetries);

if (!success)
throw new Exception("All attempts to add new state
for message has failure!");
});

Robert Stam

unread,
Oct 31, 2011, 12:03:00 PM10/31/11
to mongodb-csharp
Which line threw an exception (you didn't provide a stack trace)?

What is the declaration of the class that is failing to deserialize?
Use the mongo shell to provide the contents of the document that is
failing to deserialize. By comparing the class declaration with the
actual contents of the document we can figure out where the mismatch
is.

itsik_a

unread,
Nov 1, 2011, 3:07:04 AM11/1/11
to mongodb-csharp
Robert, I can provide the line and the stack trace but i can't figure
it out.. if it is a code problem so why sometimes i'm getting this
error and why sometimes not, while compiling the same code? this error
come's after i'm updating documents
in database, and even if i'm updating the same document in the same
way 100 times i'm not getting this error every time

in additional, after i updated the csharp driver to the last released
(1.3.0.4309) i got this error only once, so i'm thinking maybe it's
not code problem?

Robert Stam

unread,
Nov 1, 2011, 8:33:28 AM11/1/11
to mongodb-csharp
This error typically occurs when the document stored contains data
that does not match the class declaration. The only way to give a more
specific explanation is to compare your class declaration to the
actual document (which you can display using the mongo shell).

If you sometimes get this error and sometimes not it is probably
because most of your documents match the class declaration, but now
and then you encounter one that does not. Next time you encounter a
document that results in this exception, write down the_id of the
document and display it using the mongo shell. Then compare the class
declaration to the actual document, or post both of them here if you
don't see why they don't match.

itsik_a

unread,
Nov 3, 2011, 5:28:50 AM11/3/11
to mongodb-csharp
the document itself is quite long and complex because it contains
message that includes many sub-messages, and also the class definition
of the message is very complex and contains many inner class types..
so putting all this here is not so realistic. so i'm comparing my self
every field to it's class definition

Robert, Is there another possibility getting this error beside what
you said?

Robert Stam

unread,
Nov 3, 2011, 8:21:28 AM11/3/11
to mongodb-csharp
Please provide a stack trace and I can confirm the cause for you.

itsik_a

unread,
Nov 3, 2011, 8:51:24 AM11/3/11
to mongodb-csharp
System.InvalidOperationException was unhandled by user code 
Message=ReadStartDocument can only be called when CurrentBsonType is
Document, not when CurrentBsonType is String.  Source=MongoDB.Bson 
StackTrace:       at MongoDB.Bson.IO.BsonReader.VerifyBsonType(String
methodName, BsonType requiredBsonType) in C:\work\10gen\mongodb\mongo-
csharp-driver\Bson\IO\BsonReader.cs:line 788       at
MongoDB.Bson.IO.BsonBinaryReader.ReadStartDocument() in C:\work\10gen
\mongodb\mongo-csharp-driver\Bson\IO\BsonBinaryReader.cs:line 409     
 at
MongoDB.Bson.Serialization.BsonClassMapSerializer.Deserialize(BsonReader
bsonReader, Type nominalType, Type actualType,
IBsonSerializationOptions options) in C:\work\10gen\mongodb\mongo-
csharp-driver\Bson\Serialization\BsonClassMapSerializer.cs:line 115   
   at
MongoDB.Bson.Serialization.BsonClassMapSerializer.DeserializeMember(BsonReader
bsonReader, Object obj, BsonMemberMap memberMap) in C:\work\10gen
\mongodb\mongo-csharp-driver\Bson\Serialization
\BsonClassMapSerializer.cs:line 306       at
MongoDB.Bson.Serialization.BsonClassMapSerializer.Deserialize(BsonReader
bsonReader, Type nominalType, Type actualType,
IBsonSerializationOptions options) in C:\work\10gen\mongodb\mongo-
csharp-driver\Bson\Serialization\BsonClassMapSerializer.cs:line 127   
   at
MongoDB.Bson.Serialization.BsonClassMapSerializer.DeserializeMember(BsonReader
bsonReader, Object obj, BsonMemberMap memberMap) in C:\work\10gen
\mongodb\mongo-csharp-driver\Bson\Serialization
\BsonClassMapSerializer.cs:line 306       at
MongoDB.Bson.Serialization.BsonClassMapSerializer.Deserialize(BsonReader
bsonReader, Type nominalType, Type actualType,
IBsonSerializationOptions options) in C:\work\10gen\mongodb\mongo-
csharp-driver\Bson\Serialization\BsonClassMapSerializer.cs:line 127   
   at
MongoDB.Bson.Serialization.BsonClassMapSerializer.Deserialize(BsonReader
bsonReader, Type nominalType, IBsonSerializationOptions options) in C:
\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization
\BsonClassMapSerializer.cs:line 81       at
MongoDB.Bson.Serialization.BsonSerializer.Deserialize(BsonReader
bsonReader, Type nominalType, IBsonSerializationOptions options) in C:
\work\10gen\mongodb\mongo-csharp-driver\Bson\Serialization
\BsonSerializer.cs:line 229       at
MongoDB.Driver.Internal.MongoReplyMessage`1.ReadFrom(BsonBuffer
buffer, IBsonSerializationOptions serializationOptions) in C:\work
\10gen\mongodb\mongo-csharp-driver\Driver\Internal
\MongoReplyMessage.cs:line 94       at
MongoDB.Driver.Internal.MongoConnection.ReceiveMessage[TDocument]
(BsonBinaryReaderSettings readerSettings, IBsonSerializationOptions
serializationOptions) in C:\work\10gen\mongodb\mongo-csharp-driver
\Driver\Internal\MongoConnection.cs:line 383       at
MongoDB.Driver.MongoCursorEnumerator`1.GetReply(MongoConnection
connection, MongoRequestMessage message) in C:\work\10gen\mongodb
\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line 263   
   at MongoDB.Driver.MongoCursorEnumerator`1.GetFirst() in C:\work
\10gen\mongodb\mongo-csharp-driver\Driver\Core
\MongoCursorEnumerator.cs:line 223       at
MongoDB.Driver.MongoCursorEnumerator`1.MoveNext() in C:\work\10gen
\mongodb\mongo-csharp-driver\Driver\Core\MongoCursorEnumerator.cs:line
126       at
System.Linq.Enumerable.WhereSelectEnumerableIterator`2.MoveNext()

Robert Stam

unread,
Nov 3, 2011, 9:34:34 AM11/3/11
to mongodb-csharp
The stack trace confirms that you have a document which does not match
your class declaration. Specifically, your document has a string value
where a nested document (representing a nested class value) is
expected. Here's a simplified example of what you are looking for.
Suppose you have these classes:

public class C {
public int _id;
public N n;
}

public class N {
public int x;
}

And you try to deserialize a mismatched document as follows:

var bad = "{ '_id' : 2, n : 'should be a nested document, not a
string' }";
var c = BsonSerializer.Deserialize<C>(bad);

You would get the same exception that you are seeing. For comparison
purposes, here's a valid document for this class:

var valid = "{ '_id' : 1, n : { x : 1 } }";

In your case the mismatched string is nested one level deeper because
there are two calls to DeserializeMember on your stack trace.
> ...
>
> read more »

itsik_a

unread,
Nov 3, 2011, 10:47:12 AM11/3/11
to mongodb-csharp
Robert, the only thing that i can think of after looking over the
document, is that several string arrays (that are null) are serlized
to MongoDB.Driver.MongoDBNull" in the documnt", maybe when deserlize
he dont know to what type convert it? how he can know to convert it to
string array?
> ...
>
> קרא עוד »

Robert Stam

unread,
Nov 3, 2011, 11:31:30 AM11/3/11
to mongodb-csharp
Can you build the driver from the source code and set a breakpoint? If
so, here's how to find out exactly which property of which class is
having problems:

- Set a breakpoint at line 788 of BsonReader.cs (where the exception
is being thrown)
- Go to the first instance of BsonClassMapSerializer.DeserializeMember
on your stack trace
- the obj variable is an instance of the class that is currently being
deserialized
- memberMap.MemberName is the name of the property that can't be
deserialized

I'm creating a JIRA ticket to improve the error message in this case
to make it easier for users like you to figure out why the document
being deserialized doesn't match your class declaration:

https://jira.mongodb.org/browse/CSHARP-351
> ...
>
> read more »

itsik_a

unread,
Nov 3, 2011, 12:49:57 PM11/3/11
to mongodb-csharp
Robert, Thank you very much for your help
I will try it..
> ...
>
> קרא עוד »

Daniel Harman

unread,
Nov 3, 2011, 7:55:17 PM11/3/11
to mongodb...@googlegroups.com

3 thoughts...

1 - renamed this thread as title unrelated to problem!
2 - are you modifying and of these docs after persisting them, or is it going wrong simply after a save, then direct reload? If you are making modifications using direct operators on objects, its very easy to break the object vs your schema.
3 - I had some strange deserialization probs when I once forgot to make some fields properties. It serialized fine, but choked on deserialize. I don't think it was that stack trace, but just a thought....

Robert's ideas are better though if you can build and run the driver. The code is fairly easy to follow in my experience (I've had to work out a fair few things from looking at it myself....)

Otherwise you will need to try and drill down to get a repeatable test case. If you can't do this through the data easily, one approach would be to start marking properties as bson ignored and use a binary search approach to doing this to narrow down what field is causing the probs. I'd prefer the driver debug approach though!

Robert Stam

unread,
Nov 3, 2011, 8:30:32 PM11/3/11
to mongodb-csharp
This thread has had it's title changed about 5 times. How is that
happening?
> ...
>
> read more »

itsik_a

unread,
Nov 7, 2011, 10:29:31 AM11/7/11
to mongodb-csharp
Daniel. can you please give example and explain what do you mean by
"making modifications using direct operators on objects", and also you
said that you forgot to make some fields properties. what do you mean?
where?

i can't build and run the driver, and also i didn't found any
unsuitability between the document and the class definition (but
(maybe i missed something
> ...
>
> קרא עוד »

Robert Stam

unread,
Nov 7, 2011, 10:36:08 AM11/7/11
to mongodb...@googlegroups.com
If you can build the driver using the latest sources from github the following change will give you a detailed error message telling you exactly which property or field of which class can't be deserialized:


There must be a mismatch between your document and your class to get the exception you are getting. It's just a matter of finding it.

Why can't you build the driver? If you have any questions about how to do it please ask. Also, take a look at:

Daniel Harman

unread,
Nov 7, 2011, 6:13:15 PM11/7/11
to mongodb...@googlegroups.com

Ok so question is simply this. You are presumably saving objects to a typed collection?

Do you then modify/update these objects in any way before you try to load them back into your app and get that serialisation error?

field vs property:

class Foo
{
public int aField;
public int aProperty { get; set; }
}

Mongo c# driver will get into trouble deserializing into properties.

Dan

itsik_a

unread,
Nov 13, 2011, 3:23:26 AM11/13/11
to mongodb-csharp
Hi Robert,Daniel. We built the driver using the latest sources (added
the sources to our project)
and as you said we got the "problematic" property, but we couldn't
tell why (after debuging it), the property is defined and actes like
all others (his value is always null). we lost.. can we email you the
error database and unit test code and our data service implementation,
and the full error, and maybe you could help us resolving the problem?


On 7 נובמבר, 17:36, Robert Stam <rob...@10gen.com> wrote:
> If you can build the driver using the latest sources from github the
> following change will give you a detailed error message telling you exactly
> which property or field of which class can't be deserialized:
>
> https://jira.mongodb.org/browse/CSHARP-351
>
> There must be a mismatch between your document and your class to get the
> exception you are getting. It's just a matter of finding it.
>
> Why can't you build the driver? If you have any questions about how to do
> it please ask. Also, take a look at:
>
> http://www.mongodb.org/display/DOCS/CSharp+Driver+Tutorial#CSharpDriv...
> ...
>
> קרא עוד »

Robert Stam

unread,
Nov 13, 2011, 6:54:51 AM11/13/11
to mongodb...@googlegroups.com
If you email me your database and test code I will be happy to take a look at it.

itsik_a

unread,
Nov 15, 2011, 3:42:57 AM11/15/11
to mongodb-csharp
Robert. the rar file is 64Mbyte so i can't email it.. i will upload it
in some server and send the link to your email.

One more thing.. we debuged it again (with the driver sources) and
confirmed that error - when the BsonSerializer trying to
Deserialize property “Command” he think that it’s type is String
(while in the class declaration it’s “MessageCommand” (some calss of
ouers)), we saw that the BsonType given for property Command at
deserialization is 0x02 (String) instead of 0x03 (what should be
because it is complex type). so we thougt maybe the Command type used
to be String and later changed to “MessageCommand”.. but this option
is down because first of all we don't remeber it was string, secondly
we getting the same error even if we are running it in new database
instance in different machine.. any idea before i'm uploading it to
you?
> ...
>
> קרא עוד »

Daniel Harman

unread,
Nov 15, 2011, 4:00:01 AM11/15/11
to mongodb...@googlegroups.com

If it's that class, why don't you build an isolated repeatable test case around it (i.e. create a little class containing your command as a property and some code to serialise then deserialize this class in a unit test showing the problem).

You shouldn't need to send all the data etc now that you've worked out where the problem is.

Dan

Robert Stam

unread,
Nov 15, 2011, 8:47:11 AM11/15/11
to mongodb...@googlegroups.com
You could just find one sample document that fails to deserialize and then print it out in the mongo shell.

If you find that the document has a string value where it should have an embedded document then you have confirmed what the error message is telling you.

Then the question is how you ended up with a document that doesn't match your class declaration. The most common reason would be that either you class declaration used to be different (so that property used to be a string instead of a class like it is now) or that you are importing the documents from somewhere else and they don't all conform to what you expect them to be.

itsik_a

unread,
Nov 16, 2011, 5:43:30 AM11/16/11
to mongodb-csharp
non of them is the situation..
sent you download link to your email: rob...@10gen.com
i will be very glad that you have a look and maybe tell us what we did
wrong
tnx

On 15 נובמבר, 15:47, Robert Stam <rob...@10gen.com> wrote:
> You could just find one sample document that fails to deserialize and then
> print it out in the mongo shell.
>
> If you find that the document has a string value where it should have an
> embedded document then you have confirmed what the error message is telling
> you.
>
> Then the question is how you ended up with a document that doesn't match
> your class declaration. The most common reason would be that either you
> class declaration used to be different (so that property used to be a
> string instead of a class like it is now) or that you are importing the
> documents from somewhere else and they don't all conform to what you expect
> them to be.
>
> ...
>
> קרא עוד »

Robert Stam

unread,
Nov 16, 2011, 10:45:09 AM11/16/11
to mongodb...@googlegroups.com
The error message when running your unit tests is:

An error occurred while deserializing the Command property of class dbMotion.Messaging.Message: Expected a nested document representing the serialized form of a dbMotion.Messaging.MessageCommand value, but found a value of type String instead.

You have 5 documents in your database where the Command element in the stored document is a string:

> db.messages.find({"Value.Command":{$type:2}},{"Value.Command":1})
{ "_id" : ObjectId("4ead65fac84d593d94d6a025"), "Value" : { "Command" : "MongoDB.Driver.MongoDBNull" } }
{ "_id" : ObjectId("4ead6661c84d593d94d6a026"), "Value" : { "Command" : "MongoDB.Driver.MongoDBNull" } }
{ "_id" : ObjectId("4ead6967c84d593d94d6a02a"), "Value" : { "Command" : "MongoDB.Driver.MongoDBNull" } }
{ "_id" : ObjectId("4ead68e5c84d593d94d6a029"), "Value" : { "Command" : "MongoDB.Driver.MongoDBNull" } }
{ "_id" : ObjectId("4ead6887c84d593d94d6a028"), "Value" : { "Command" : "MongoDB.Driver.MongoDBNull" } }
>

You also have some documents where the Command is null:

> db.messages.find({"Value.Command":null},{"Value.Command":1})
{ "_id" : ObjectId("4ead6849c84d593d94d6a027"), "Value" : { "Command" : null } }
{ "_id" : ObjectId("4ead69adc84d593d94d6a02b"), "Value" : { "Command" : null } }
{ "_id" : ObjectId("4ead69c5c84d593d94d6a02c"), "Value" : { "Command" : null } }

but that's OK, null is valid (but the string "MongoDB.Driver.MongoDBNull" is not).

This is probably data left over from when your class declarations or your code looked different.

I think if you clean up your data you will be fine.

itsik_a

unread,
Nov 20, 2011, 4:22:26 AM11/20/11
to mongodb-csharp
I can't understand why "MongoDB.Driver.MongoDBNull" is a problemwhen
i'm writing :
   public class message    {        public ObjectId Id { get; set; } 
      public string Title { get; set; }        public string Tag
{ get; set; }    }
    class Program    {        static void Main(string[] args)       
{            MongoServer server = MongoServer.Create();           
MongoDatabase db = server.GetDatabase("mongodbError");           
MongoCollection<message> collection =
db.GetCollection<message>("messages");            var message = new
message()            {                Title = null,                Tag
= "mess"            };            try            {               
collection.Save(message);            }            catch (Exception e) 
          {                Console.WriteLine(e.Message);            } 
      }    }
i'm getting the document:{ "_id": { "$oid" :
"4ec8c24f5a9e0e03dc7a335c" }, "Title": "MongoDB.Driver.MongoDBNull",
"Tag": "mess" }and that's ok because (as you claim) property Title is
a string..
but even when i'm changing the type of property Title to a class type,
i'm getting the same document with no exception:
    public class foo    {        public string i { get; set; }       
public int g { get; set; }     }
    public class message    {        public ObjectId Id { get; set; } 
      public foo Title { get; set; }        public string Tag { get;
set; }    }
    class Program    {        static void Main(string[] args)       
{            MongoServer server = MongoServer.Create();           
MongoDatabase db = server.GetDatabase("mongodbError");           
MongoCollection<message> collection =
db.GetCollection<message>("messages");            var message = new
message()            {                Title = null,                Tag
= "mess"            };            try            {               
collection.Save(message);            }            catch (Exception e) 
          {                Console.WriteLine(e.Message);            } 
      }    }
i'm getting the document:{ "_id": { "$oid" :
"4ec8c4035a9e0e1270e316f9" }, "Title": "MongoDB.Driver.MongoDBNull",
"Tag": "mess" }without any Exception!
So i don't understand your answer, can you explain?
> ...
>
> קרא עוד »

Robert Stam

unread,
Nov 20, 2011, 9:45:07 AM11/20/11
to mongodb...@googlegroups.com
After running your first program and checking the results with the mongo shell I see:

> use mongodbError
switched to db mongodbError
> db.messages.find()
{ "_id" : ObjectId("4ec90ff2e447ad1ae4e8f9a0"), "Title" : null, "Tag" : "mess" }
>

After running your second program and checking the results again with the mongo shell I then see:

> db.messages.find()
{ "_id" : ObjectId("4ec90ff2e447ad1ae4e8f9a0"), "Title" : null, "Tag" : "mess" }
{ "_id" : ObjectId("4ec9112fe447ad2ed03219ca"), "Title" : null, "Tag" : "mess" }
>

So in both cases it added a value of null for Title. I don't see any occurrences of the string "MongoDB.Driver.MongoDBNull".

Not sure how you are getting your results. Are you using the mongo shell to look at your documents or something else?

If you do have a string value of "MongoDB.Driver.MongoDBNull" it is a problem because the matching property in the class you are deserializing is expecting an embedded document containing the serialized form of that property. The value could be null in the document, and that would be OK, but a string value is not OK. It doesn't matter what the contents of the string are, it can't be a string.

itsik_a

unread,
Nov 20, 2011, 9:56:00 AM11/20/11
to mongodb-csharp
I'm using tool called "mongo Explorer".. can you tell me what is
MongoDB.Driver.MongoDBNull, and in which situations a property can get
this value??
I think that understanding that will direct me how to solve my
problem

> ...
>
> קרא עוד »

Robert Stam

unread,
Nov 20, 2011, 10:08:26 AM11/20/11
to mongodb...@googlegroups.com
When "MongoDB.Driver.MongoDBNull" is enclosed in quotes it is a string. No different from "xyz".

I don't know what MongoDB.Driver.MongoDBNull is. There is no such class in the official C# driver.

Try looking at your documents in the mongo shell and see if the problem is with MongoExplorer.

itsik_a

unread,
Nov 21, 2011, 5:55:51 AM11/21/11
to mongodb-csharp
Robert thanks! the problem solved
that string is belong to the Mongo Explore tool (it's class of their
csharp driver)
and probably that value is saved in our property because every
manipulation made
on a document in mongo explorer change the value in the database
itself..
they fixing that problem at this moment

> ...
>
> קרא עוד »

Robert Stam

unread,
Nov 21, 2011, 9:00:46 AM11/21/11
to mongodb...@googlegroups.com
Glad to hear that we finally got to the bottom of it.
Reply all
Reply to author
Forward
0 new messages