Questions tagged [10gen-csharp-driver]

11 questions
12
votes
1 answer

How do you increment a field in mongodb using c#

Thought this would be pretty straight forward, but my value is remaining the same (0). What I'd like to do is increment my UnreadMessages field when the user receives a message they haven't read and then decrement it when they have. So I thought…
rball
  • 6,925
  • 7
  • 49
  • 77
6
votes
1 answer

Mongo C# Fluent Aggregation Pipeline Group Anonymous Type Key Exception

I am using the new Fluent Aggregation Pipeline in v2 of the 10gen Mongo C# driver, but am experiencing an exception when trying to group by more than one field (example code below). The Exception that is thrown is ... Command aggregate failed:…
6
votes
3 answers

Deserialization Error ASP.NET MongoDB

I am trying to retireve all the documents in my MongoDB collection via a REST api built in ASP.NET MVC 4 and I have encoutered an error when i enter localhost:50491/api/document: An error occurred while deserializing the Id property of class…
Mike Barnes
  • 4,217
  • 18
  • 40
  • 64
4
votes
1 answer

How to query a sub document collection using MongoDB and C# driver

I have the following structure: public class ThreadDocument { public ThreadDocument() { Messages = new List(); Recipients = new List(); } [JsonIgnore] public ObjectId Id { get; set; } …
rball
  • 6,925
  • 7
  • 49
  • 77
3
votes
1 answer

How to cache some temp data in MongoDB?

I have some client-server application. And as one of its part, I need to implement a paginal approach on client side. I am making data footprint from db (I'm using MongoDB with 10gen's driver) on server-side and then give part of the footprint on…
2
votes
1 answer

connecting mongodb to c#

I use c# and asp.net mvc (visual studio 2015). When I try to connect mongodb to c#,this error appears: MongoDB.Driver.MongoConfigurationException: The connection string 'mongodb:://localhost' is not valid. and the error source is: var client = new…
mypeeka
  • 57
  • 2
  • 11
2
votes
3 answers

How can I update a inner property using the 10gen c# driver?

I have this structure: public class User { public ObjectId Id { get; set; } public Location Location { get; set; } public DateTime LastAround {get;set;} } public class Location { public double Latitude { get; set; } public…
rball
  • 6,925
  • 7
  • 49
  • 77
1
vote
2 answers

C# 10gen and mongo: deserialization for members as interfaces

All Consider this example: private class CollectionHolder { public ObjectId Id { get; set; } public MyCollection Collection { get; set; } } private class MyCollection : List { public…
Rustem Mustafin
  • 957
  • 1
  • 11
  • 23
0
votes
2 answers

How to add placeholder to c# code?

How to add placeholder to c# code ? I want to display DateTime.Now in my form.
@Html.EditorFor(model => model.Date, new { htmlAttributes = new { @class = "form-control" } }) @Html.ValidationMessageFor(model =>…
0
votes
1 answer

Hash-Based Sharding in MongoDB

I am trying to set up hash-based sharding, but it doesn't works. I am using mongo 2.4. It would be great to see real examples of how to start mongo claster. (steps) How to configure hash-based sharding for large MongoDB deployment?
Andrei
  • 42,814
  • 35
  • 154
  • 218
0
votes
1 answer

Search Substring on a Integer Value

Let's say we have a mongodb collection that has elements containing an int attribute value like: {"MyCollectionAttribute": 12345} How can I search the string "234" inside the int using Query. syntax? For now it seems to work(as explained here)…
eugen
  • 464
  • 5
  • 16