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 C# Combining Fields

The Plan: So now what I basically want is to take my propertys out of the class, let the user pick some and then pull a List with ONLY those propertys out of MongoDB. The Code: here is where the method starts: private void…
1
vote
1 answer

MongoDb.Driver 2.4 deserilization data type changing

I have the following POCO class: class MyClass { public Objectid _id {get;set;} public string property1 {get;set;} public string property2 {get;set;} public int property3 {get;set;} } The object is stored in the MongoDb collection. …
1
vote
1 answer

How to fetch first 1000 documents that don't have certain field?

Say, I have collection People. How should I fetch first 1000 documents that doesn't have a field Phone? As I understand, I should use $exists however I cannot understand how to use it from .NET driver and there is next to no info on that topic on…
nicks
  • 2,161
  • 8
  • 49
  • 101
1
vote
0 answers

C# driver for MongoDB: another way to insert data and avoid memory limit

I'm creating a tool for our data, reading data with Entity Framework from our SQL Server database and inserting them, row by row, in our MongoDB database. In my code, I start in this way: _client = new MongoClient(); _database =…
Piero Alberto
  • 3,823
  • 6
  • 56
  • 108
1
vote
0 answers

How to prevent MongoDB C# from retrying a failed login

We're creating an audit-testing tool which is deliberately trying to log into all of our Mongo servers using invalid credentials (non-existent user). It's purpose it to allow us to track that the failed login is getting logged by our auditing…
InbetweenWeekends
  • 1,405
  • 3
  • 23
  • 28
1
vote
1 answer

Regular Expression option "/x" (ignore option is not working in MongoDB C# Driver

I have to perform find/replace functionality in my app and we decided to add ignore space option to our regular expression Mongo query. so using this code BsonRegularExpression breg = new BsonRegularExpression (pattern,request.matchCase ? "x" :…
mimrezash
  • 11
  • 1
1
vote
1 answer

Repository pattern and aggregate root pattern. How to make SaveChanges in repository?

We recently started using repository pattern and aggregate root pattern. This is all working super well when I am tracking the changes using EntityFramework, and I am able to call SaveChanges, when I am done with the work on my aggregate. Now my…
Kristian Barrett
  • 3,574
  • 2
  • 26
  • 40
1
vote
2 answers

MongoDB: C# or JavaScript?

I am not deep in working with MongoDB. But i want to use it with C# driver. I guess that not all features can be available in this driver (Am i right?). Or for example, it easy to find some code written on javascript and, so, it seems easy to use it…
Edward83
  • 6,664
  • 14
  • 74
  • 102
1
vote
2 answers

Unable to determine the serialization information for *expression* using .Date

I'm trying to read from a mongoDB collection with a Date filter (only the Date, time should be ignored): var filterDefinition = Builders.Filter.Eq(p => p.SomeDateTimeProperty.Date, DateTime.Now.Date); using (var cursor = await…
Claudiu Constantin
  • 2,138
  • 27
  • 38
1
vote
1 answer

MongoDB Stored Procedure (javascript function) that updates documents before it returns them as results?

I'm in the process of converting a system from sql server to mongodb. I believe the project is a good candidate for mongodb, but that's not my question. In the sql database, i have a stored procedure that I use to return a set of records that need…
Redth
  • 5,464
  • 6
  • 34
  • 54
1
vote
1 answer

Map old field name and new field name from mongodb document to the same c# field

Does the MongoDB C# driver have the ability to map two field names from the server to a single field in the C# class? The reason that we need this is that we've renamed a field in our code and would like to support both the old and new field name…
GaTechThomas
  • 5,421
  • 5
  • 43
  • 69
1
vote
0 answers

Split an element in an array into two in mongodb

I have an array of time periods on a mongo document. it looks something like this { spans: [{from:2016-1-1, to:2016-1-4}, {from:2016-2-1, from:2016-2-4}] } I want to spit the first item into two (eg modify the existing element and…
undefined
  • 33,537
  • 22
  • 129
  • 198
1
vote
1 answer

MongoDB is very slow on Azure Platform

I was created MongoDB database in Linux Server (Standard D2 v2 (2 cores, 7 GB memory)) on the Windows Azure Platform. I'm testing data insert to database with following codes. But result is not good..! 47 second for inserting 100.000 record very…
1
vote
0 answers

Projection of mongodb BsonId using C# .NET driver 2.2.4

I have the following structure: public abstract class DbEntity { [BsonId] public ObjectId Id { get; set; } [BsonDateTimeOptions(Kind = DateTimeKind.Utc)] public DateTime CreatedAt { get; set; } [BsonDateTimeOptions(Kind =…
1
vote
1 answer

How to apply mongodb query on List in C#?

I am developing simple web services in c# using MongoDB. I get stuck in one place, In my mongoDocument I have list of userIds as below(just for example), "_id" : ObjectId("57ce7aa1c54ec61774f0a91d"), "MobileNumber" : "9652365485", "Password" :…
Gaurav Radadiya
  • 213
  • 3
  • 16