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
problem querying with 10gen's C# driver
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
 
Joe  
View profile  
 More options Dec 13 2010, 10:15 am
From: Joe <joe.d.g...@gmail.com>
Date: Mon, 13 Dec 2010 07:15:06 -0800 (PST)
Local: Mon, Dec 13 2010 10:15 am
Subject: problem querying with 10gen's C# driver
Please forgive me if this is the wrong group.  I'm still not 100%
clear on which group is for the Samus C# driver and which is for the
10gen driver.

I am having a hard time figuring out an error querying the DB.

I am trying to get a single result out of a typed collection:

// works
var w = Database.GetCollection( Table.Names.ADMIN_USERS );
var x = w.FindOne( Query.EQ( "Username", username ) );

// does not work
var y = Database.GetCollection<AdminUser>( Table.Names.ADMIN_USERS );
var z = y.FindOne( Query.EQ( "Username", username ) );

I get the following:
System.InvalidOperationException: ReadString cannot be called when
BsonType is: ObjectId

Thanks,
Joe


 
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.
Joseph Good  
View profile  
 More options Dec 13 2010, 10:18 am
From: Joseph Good <joe.d.g...@gmail.com>
Date: Mon, 13 Dec 2010 09:18:25 -0600
Local: Mon, Dec 13 2010 10:18 am
Subject: Re: [mongodb-csharp] problem querying with 10gen's C# driver

If it matters, the FindOneAs<AdminUser> also fails when applied to the
non-typed collection.


 
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 Dec 13 2010, 10:31 am
From: Robert Stam <rstam10...@gmail.com>
Date: Mon, 13 Dec 2010 07:31:41 -0800 (PST)
Local: Mon, Dec 13 2010 10:31 am
Subject: Re: problem querying with 10gen's C# driver
There is probably a mismatch between the data in the database and your
class definition. My guess is that in your class you declared the Id
field to be of type string, but in the database it is an ObjectId.

Can you share the declaration of your AdminUser class and also the
contents of the document in the database using the mongo shell:

> db.users.find({"Username" : "xyz"})

Comparing the two should reveal the cause of your error message.

On Dec 13, 10:18 am, Joseph Good <joe.d.g...@gmail.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.
Joseph Good  
View profile  
 More options Dec 13 2010, 10:43 am
From: Joseph Good <joe.d.g...@gmail.com>
Date: Mon, 13 Dec 2010 09:43:08 -0600
Local: Mon, Dec 13 2010 10:43 am
Subject: Re: [mongodb-csharp] Re: problem querying with 10gen's C# driver

Robert,

Thanks for pointing that out, and in under 15 minutes of me asking.  You
nailed the exact problem.

Well, now for me to go rethink my idea of making a portable multi-target DTO
layer.

-Joe


 
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 »