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
3 answers

Projection in Where Clause Query of a Embedded document in MongoDB Collection using C#

Filter the Collection in DB instead of Memory I'm having a Model Class, Save it in a MongoDB Collection then Query the same as per my expectation mentioned below. My Model Class: public Class Employee { public ObjectId Id { get; set; } …
user6060080
1
vote
1 answer

How to pass Dynamic IMongoQuery in c# controller

I have pass a Query using ImongoQuery as userInfoDataQuery in the below method. but i don't know how to filter this query in a collection. public IQueryable UserInfoDataByQuery(IMongoQuery userInfoDataQuery) { if (ServerIsDown) return…
Neeraj Mehta
  • 1,675
  • 2
  • 22
  • 45
1
vote
0 answers

In MongoDB for C# is there a way to exclude members implicitly but still be able to get them explicitly?

Is there a way to implicitly exclude certain fields/types in some DB model in C#'s MongoDB, while still allowing to get them explicitly? for instance, I have a Model with two big lists: public class Model { public string SomeName; public…
Tar
  • 8,529
  • 9
  • 56
  • 127
1
vote
0 answers

NearSphere Query with paging order by distance

In MongoDb I can make queries to get entries near to a point. As I need paging I use the overload which accepts a sort and a paging parameter. So my Query looks like this: Filter.NearSphere(x => x.Geolocation,…
Boas Enkler
  • 12,264
  • 16
  • 69
  • 143
1
vote
1 answer

How to catch errors if IMongoCollection.InsertOneAsync(...) returns no value nor throws any exception (according to documentation)?

Since IMongoCollection.InsertOneAsync(...) returns no value (except the awaitable Task), and its documentation says nothing about exceptions, how can I be sure that the new record was added and no error has happened? IMongoCollection
Tar
  • 8,529
  • 9
  • 56
  • 127
1
vote
0 answers

Nested Conditions in Mongquery

In one code i had the following filter Definition (filter is a instance of FilterDefinitionBuiler ) filter = Filter.And( Filter.Eq(x => x.CompanyId, companyId), Filter.Eq(x => x.DepartureProviderUniqueValue, departureValue), Filter.Eq(x…
Boas Enkler
  • 12,264
  • 16
  • 69
  • 143
1
vote
1 answer

MongoDB C# Driver Insert Dynamic Entity

I' m building ASP.NET Web API and using MongoDB to store data. Some of properties should be dynamic at the class as below public class SampleModel { public dynamic Config { get; set; } public string Name {get; set; } } JObject is also used…
Anil Kocabiyik
  • 1,178
  • 6
  • 17
  • 47
1
vote
1 answer

Mongo C# Driver - GeoJson Polygon to GeoJsonLinearRingCoordinates

I'm new to the Mongo C# driver and I'm trying to create a intersect query in C#. I have the function working in Javascript but I'm struggling with some of the classes in the Mongo driver. At the moment I have the GeoJson pulling fine but when I…
Lereveme
  • 1,614
  • 2
  • 15
  • 18
1
vote
1 answer

AsQueryable linq statement with selecting the ID field

Given a simple model: public class Model{ private string _id; [BsonId(IdGenerator = typeof(StringObjectIdGenerator))] [BsonRepresentation(BsonType.ObjectId)] public string Id { get { return _id; } set { _id = value;…
Colsa CSF
  • 33
  • 1
  • 6
1
vote
0 answers

The wait queue for acquiring a connection to server ******* is full. [MongoDB]

I'm having this error... I'm using ASP.NET Core with the last version of driver C#. The wait queue for acquiring a connection to server [server:port] is full. Failed…
chemitaxis
  • 13,889
  • 17
  • 74
  • 125
1
vote
1 answer

C# BsonDocument.Parse and invalid JSON

Am I missing something? BsonDocument.Parse() appears to allow invalid JSON input where there is valid document before the invalid characters start? For example I would consider invalid, but parses fine: { "_id":…
Lloyd
  • 29,197
  • 4
  • 84
  • 98
1
vote
2 answers

Unable to filter on Date fields in MongoDB using C# Driver

I am manually serializing a number of POCOs using Newtonsoft JsonTextWriter and saving the result as a MongoDB BsonDocument. // // POCO to store in MongoDB public class Session { public DateTime? StartUTCTimestamp { get; set; } public…
Gary O. Stenstrom
  • 2,284
  • 9
  • 38
  • 59
1
vote
1 answer

mongodb C# V2: What is the impact of the different Filter methods

As far as I know you can query mongodb with FindAsync using: Linq.Where A lambda expression that is called for every document in a collection Creating a Filter with the Builder<> class Now: Is there a difference in performance or the way…
Thomas
  • 8,397
  • 7
  • 29
  • 39
1
vote
5 answers

mongoDB: C# driver V2 How to update item in a nested collection

I have the following Class design: public class UserDayStore { public Guid Id { get; set; } public string UserName { get; set; } public string Password { get; set; } public DateTime EndOfSubscription { get; set; } public bool…
Thomas
  • 8,397
  • 7
  • 29
  • 39
1
vote
1 answer

Issues querying a MongoDB by date range with powershell

I can not get my query in powershell to work for a date range. below is my mongodb doc and powershell code. I have to switch to UTC time to match the time in mongodb. I have tried several different date formats and still can not find any records…
Ross Jurek
  • 11
  • 1
1 2 3
99
100