Tech
Forums
Jobs
Books
Events
Interviews
Live
More
Learn
Training
Career
Members
Videos
News
Blogs
Login
Sign Up
Ask Question
1
Reply
Fetching the document from mongodb by passing the parameters
Kavya Durgam
Dec 11 2017 2:51 AM
157
Reply
I need to check the document exixts in the mongodb based on combination of 3 parameters.
this is the query worked on mongo db command prompt:
db.FrequencyQuestionForm.find({"data.formList.Identificatio
nDetails.Study_Id":"1"},{"data.formList.IdentificationDetails.Visit_No":"1"}).li
mit(1)
I want to use this query in entity framework.
[HttpGet]
public object getFrequencyQuestionData()
{
var connectionString = "mongodb://localhost:27017";
MongoClient client = new MongoClient(connectionString);
MongoServer server = client.GetServer();
MongoDatabase db = server.GetDatabase("FormDataBase");
MongoCollection collection = db.GetCollection<Blog>("FrequencyQuestionForm");
// Here i want to call that query ..
MongoCursor<Blog> cursor = collection.FindAllAs<Blog>();
var count = collection.Count();
string document = cursor.ToJson();
JToken token = JToken.Parse(document);
var jObject = JObject.FromObject(new { formdata = token, count });
return jObject;
}
Upload Source Code
Select only zip and rar file.
Post
Reset
Cancel
Answers (
1
)
Next Recommended Forum
Online moviee ticket booking in mvc
How to use various charts in asp C#