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

Update a nested Array in Mongo with c#

I have a document like this { "_id": "63dafa72f21d48312d8ca405", "tasks": [{ "_ref": "63d8d8d01beb0b606314e322", "data": { "values": [{ "key": "Deadline", "value": "2014-10-13" }] } }, { …
Kleisophabo
  • 29
  • 1
  • 6
1
vote
1 answer

Getting all documents from a property-combo

This might be very simple, however I am having a hard time figuring it out: I have a List> that contains a list of products that I need to search for, and I would like to get all documents of all products that is represented in…
1
vote
0 answers

Unexpected behaviour of tailable cursor with mongos

I'm triyng to change my MongoDB replica set to shard cluster. I have the following code in my app: var cursor = _messages .Find(Query.GTE(x => x.Timestamp, fromTimestamp)) .SetFlags(QueryFlags.TailableCursor | QueryFlags.AwaitData) …
nameless_one
  • 139
  • 6
1
vote
0 answers

MongoDB C# string comparison

I tried to do string comparison using MongoDB C# driver, However, I always got error message as following: Unable to determine the serialization information for the expression: y.strVal.CompareTo("15.5") var q2 = from objb in q1.AsQueryable() …
flyfish
  • 31
  • 6
1
vote
1 answer

Reading null into a nullable int with MongoDB C# driver

I have data in my MongoDB where I am storing a nullable int, most often as null. My model on the C# side has the variable as int? MaterialID. When I run .Query.FirstOrDefault(), I get an error "Input string was not in a correct format." whenever it…
Microsoft Excel
  • 159
  • 2
  • 11
1
vote
1 answer

UpdateMany operation specifying filter as _id in

I have a series of ObjectIds and I want to update a property in all documents where there's a match with the ObjectIds. So basically the SQL equivalent of: update collection set prop = false where id in (1,2,3) The Query I have built for Mongo…
RizJa
  • 1,961
  • 1
  • 21
  • 38
1
vote
1 answer

Filter using derived type's fields

We're bringing our API into the 21st century, and updating all of our queries to use the newer (2.4) Mongo C# driver. One of our queries has this filter: Query.Or( Query.EQ(p => p.UserId, userId), Query.In(p…
ProgrammingLlama
  • 36,677
  • 7
  • 67
  • 86
1
vote
1 answer

Inserting & Updating Data in MonogoDB 3.4 with C# Driver 2.3 in an MVC application

I am currently working on an MVC application using MongoDB and I'm generally a rookie with development. This my first foray into MongoDB; I have zero formal training with Mongo and now I'm stuck. My question is: What is the correct syntax for…
1
vote
1 answer

MongoDb Asp.Core define and use key (not value) in a relationship

Context In our app, we permit to our users to upload files, which will be placed in a queue for review and approbation. User's file ID will be stored as a "sub-list" (I don't know the name) in the user specific Mongo Database. Question summary My…
BlackHoleGalaxy
  • 9,160
  • 17
  • 59
  • 103
1
vote
1 answer

Content search of uploaded image in mongodb

I have to search contents within file . that is uploaded in db like image(bmp,tiff,png) or pdf etc. I am using latest release Mongodb for storing images(png,bmp,jpg) or documents using GridFS. that is storing data in binary . MongoDB uses two ways…
naila naseem
  • 185
  • 1
  • 1
  • 8
1
vote
0 answers

BSON Customer Serializer - determine if type is being used as Id field

I have written a custom Bson Serializer by extending SerializerBase When serializing, I'd like to detect whether the object being serialized is being used as the Id field for the overall document. If it is, I'd like to serialize as a string. If…
Suraj
  • 35,905
  • 47
  • 139
  • 250
1
vote
3 answers

Mongodb .net client options, which one do you prefer? Why?

* mongodb-csharp driver * simple-mongodb driver * NoRM There are three mongodb clients for .net, all of them appears to have same numbers of followers. As i am new to mongodb can't differentiate both by just looking features right now. If you are…
mamu
  • 12,184
  • 19
  • 69
  • 92
1
vote
1 answer

MongoDB C# Query: Filter + Aggregation + Checking if value is true/false

I need to perform a pretty complex MongoDB query and I'm having a really hard time being able to narrow the entire thing down to one query, although I do think it's doable I don't really have enough experience with MongoDB to get it quite right and…
Ofir Z
  • 95
  • 1
  • 11
1
vote
1 answer

Cant deserialize inherited object with Mongo c# driver

I am using AspNetCore.Identity.MongoDB nuget package to get some Asp.Net Identity features into my project. Then I want to extend the MongoIdentityUser that exists with the User type I originally created for my project, so I tried to inherit from…
Mech0z
  • 3,627
  • 6
  • 49
  • 85
1
vote
2 answers

C# MongoDB driver 2.4 - How to add a GeoSpatial index

I upgraded my MongoDB-C# driver, and I couldn't find information about how to create a GeoSpatial index. I have seen many posts using collection.EnsureIndex, but I don't have that available. I used to use the following, where 'collection' is…
user1202839
  • 365
  • 1
  • 5
  • 18