Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8660291
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T16:13:09+00:00 2026-06-12T16:13:09+00:00

With the recent update to 10gen c# driver for mongodb I want to update

  • 0

With the recent update to 10gen c# driver for mongodb I want to update my code so it use the strongly typed version.

My previous call was :

var update2 = new UpdateBuilder();
var index = album.Ratings.IndexOf(rating);
update2.Set("Ratings." + index + ".Number", number);
update2.Set("Rating", album.Rating);
_session.Db().GetCollection<Album>("Album")
    .Update(Query<Album>.Where(x => x.Id == objId), update2); //this line is working

The new call would be :

update.Set(x => x.Ratings[index].Number, number);
//update2.Set("Ratings." + index + ".Number", number); previous call

But I get this exception :

Unable to determine the serialization information for the expression:
(Album x) =>
x.Ratings.get_Item(WebApp.Areas.API.Controllers.RatingController+<>c__DisplayClass5.index).Number.

Is there any way I can update an item inside a List?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T16:13:10+00:00Added an answer on June 12, 2026 at 4:13 pm

    Interesting problem. This works when using a constant like below:

    var update = Update<Album>.Set(x => x.Ratings[0].Number, 10);
    

    However, this apparently breaks when you use a variable, like you have done with index. This is definitely a bug. I have created a Jira issue for it here: https://jira.mongodb.org/browse/CSHARP-598.

    This is most likely due to us not partially evaluating the expression before processing it.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I use Code::Blocks with Boost::Jam. A recent update to C::B added some new custom
This code snippet used to work. I think a recent update of Google Chrome
The recent ATL security update updated the C++ runtimes to version 8.0.50727.4053. Unfortunately, this
I would like to update grep on my Mac to a more recent version
I'm trying to program something like facebook recent update part,so I program following code
The recent update (V 20.x) of Chrome has broken one of my forms with
Since recent update Xcode 4.3 now seems to default to LLDB debugger. I just
I've got rejected my recent update on iPhone app and it says: When file
I'm about to batch update every node in my database. Having made a recent
In recent versions of python, one can use something like with open('abc.txt') as f:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.