Questions tagged [mongodb-.net-driver]

The official MongoDB .NET Driver provides asynchronous interaction with MongoDB.

MongoDB .NET Driver

The next generation .NET driver for MongoDB

Introduction

The official MongoDB .NET Driver provides asynchronous interaction with MongoDB. Powering the drivers is a Core library and a BSON library.

Features

  • Driver - A completely async driver to talk with MongoDB.
  • GridFS - A distributed file system built on MongoDB.
  • Core Driver - The MongoDB Driver is built on top of a new Core library which anyone can use to build alternative or experimental high-level APIs.
  • BSON Library - A standalone BSON library, with a serialization infrastructure that you can use to build high-performance serializers.

MongoDB .NET Driver Documentation

2641 questions
1
vote
1 answer

MongoDB exception using C# Fluent Aggregation Framework

I'm trying to write a very simple grouping query, using the MongoDB fluent aggregation syntax in the C# driver. I'm grouping documents by author and returning the count per author. I don't need to return the author names, only the counts. The…
1
vote
1 answer

cannot edit any value in this datagridview

i have a datagridview bould on a list from Mongodb. however i cannot edit the grid. I dunno why its like that? var connstr = "Server=localhost:27017"; mongo = new Mongo(connstr); mongo.Connect(); IMongoDatabase TorontoTrader =…
junkone
  • 1,427
  • 1
  • 20
  • 45
1
vote
1 answer

MongoDB C# - LINQ Contains against a string array throws ArgumentException

I'm new to MongoDB so this might be a naive question, yet I have not found any relevant/up to date information by googling around: I am trying to use the MongoDB C# driver (version 2.2.4) to compose a LINQ-based query, one piece at a time, from a…
Naftis
  • 4,393
  • 7
  • 63
  • 91
1
vote
1 answer

ToString not behaving as expected in child class of BsonDocument

I'm upgrading an existing project from the 1.10.0 Mongo Driver to 2.2.4 and encountered some unexpected behavior in a class that inherits from MongoDB.Bson.BsonDocument. The original developers extended BsonDocument with a class called…
HopAlongPolly
  • 1,347
  • 1
  • 20
  • 48
1
vote
1 answer

Update document in C# driver v2 migrate from Driver v1

My code using C# Mongo Driver Version1 Repository /// /// Generic update method to update record on the basis of id /// /// ///
tree em
  • 20,379
  • 30
  • 92
  • 130
1
vote
0 answers

How to initiate UserStore of AspNet.Identity.MongoDB

My problem is that UserStore requires IMongoCollection to initiate but MongoDb's C# driver's GetCollection Method returns MongoCollection public class UserService : IUserService { private IRepository _wspUserRep; public…
Raas Masood
  • 1,475
  • 3
  • 23
  • 61
1
vote
1 answer

Selecting from a IMongoQueryable collection with a Linq Expression throws an error [c# driver 2.2.4]

Using the mongoDb c# driver 2.2.4, selecting from a IMongoQueryable collection with a Linq Expression throws an error because of my Id field. Here is the code: MongoDB.Driver.MongoClient myClient = new…
1
vote
1 answer

C# MongoDB driver strongly typed filter usage

The documentation tells you how to define a filter, but not how to use it. public class Widget : BsonDocument { [BsonElement("X")] public int X { get; set; } [BsonElement("Y")] public int Y { get; set; } } public MyItem Get() { …
lapsus
  • 2,915
  • 2
  • 32
  • 61
1
vote
1 answer

GeoSpatial queries working find in mongo shell but not filtering in C# driver

I'm having this weird problem while using mongo to query locations near a geographical point. I notice that whenever I try filtering by $nearSphere through the C# driver the filter just returns all matches regardless of whether they're in the given…
1
vote
1 answer

What is the maximum size of an object to store in a MongoDb collection using the C# Driver 2.1.1?

I use the mongoDB C# driver 2.1.1 to store and retrieve documents in a mongoDb collection. This worked well so far until one document was CORRECTLY stored but could not be read back by the driver. I got to that conclusion using robomongo (a user…
DevBackFlo
  • 94
  • 8
1
vote
0 answers

MongoDB Unable to determine the serialization information for lambda

I need to build a complex query with the Mongo C# driver. I already have a working query with intellishell. db.Organizations.aggregate( // Pipeline [ // Stage 1 { $match: { "$and" : [ { "Country.Path"…
Karine
  • 581
  • 1
  • 6
  • 20
1
vote
0 answers

How do I update this nested sub-document in MongoDB?

I have this document structure in MongoDB. I need to find and update a song for a given artist, album id When someone likes a song, I need to increase the likes count and add the user to the votes list. Sample document: artists = [{ "_id": 1, …
kheya
  • 7,546
  • 20
  • 77
  • 109
1
vote
0 answers

Can bulk insert on multiple thread produce duplicate record in mongoDB

I am performing some operation in mongoDB where in am doing bulk insert WritemanyAsync() on multiple thread. Say, there are two entities J and C (Collection). On every update of document J am fetching all C and similarly for every update of document…
Rahul
  • 76,197
  • 13
  • 71
  • 125
1
vote
1 answer

Equivalent for SetUnion in C# driver

I have a field in mongodb document which contains an array of numbers. I want to update this field with newly received numbers. But i need to add the numbers only if the number is not present in the array. In MongoDB we can use $setUnion but i am…
kalaimani
  • 35
  • 1
  • 5
1
vote
1 answer

Multiple Logical Conditions in MongoDB Select

I need to Query a Collection based on Multiple Condition My Collection { "_id" : ObjectId("575f4e2efd14481598fc0ebf"), "Emp_ID" : "100", "LastUpdate" : ISODate("2016-06-13T18:30:00.000Z") }, { "_id" :…
user6060080