norm

Get the 1-norm of a vector in Python

How can I calculate the 1-norm of the difference of two vectors, ||a - b||_1 = sum(|a_i - b_i|) in Python? a = [1,2,3,4] b = [2,3,4,5] ||a - b||_1 = 4 ...

Retrieving the norm of an unstored field in Lucene

I have an existing Lucene index with an indexed, unstored field. Let's name the field longText. I need the norm of longText for a specific calculation. Not all the documents in the index have a longText field. When I try to get the norm for longText from a document that does not have this field, I always get 1.0, which is the default, bu...

MongoDB transactions?

Playing around with MongoDB and NoRM in .NET. Thing that confused me - there are no transactions (can't just tell MongoConnection.Begin/EndTransaction or something like that). I want to use Unit of work pattern and rollback changes in case something fails. Is there still a clean way how to enrich my repository with ITransaction? ...

How can I use mongodb with linq for store large binary objects(files)?

I know two most popular C# drivers for mongodb, this are mongodb-csharp and NoRM. Both of them have some problems. For example, with mongodb-csharp I can't use full functional linq and with NoRM I can't store large file in mongodb. In my project, I need to use linq with large objects (files). ...

What is the most mature MongoDB driver for C#?

So, there are mongodb-csharp simple-mongodb NoRM as C# drivers for MongoDB available. Which one of them is the most mature and stable one? Why would you choose one over the other two? Are they production ready? ...

How to combine conditional operator in NoRM driver for MongoDB

Hi guys In mongo native api it is possible to do following: db.collection.find({ "field" : { $gt: value1, $lt: value2 } } ); // value1 < field < value How could I achieve the same with NoRM Best regards, Dmitry Egorov ...

MongoDB Norm query nested objects

Does anyone have a sample of how to query for nested/inner objects in MongoDB using NORM (C#)? For example, if a typical document in a collection looks like Order/OrderItems, how can I look up a specific OrderItem by OrderItem.Quantity > 10. ...

How to specify to NOT map an object Property in MongoDB with NORM

Hi, I have a calculated property in my object that I don't want to save to the DB, is there a way I can specify that? Like this one as an exemple : public virtual string FullInfos { get { var html = Contact1Info; html += Contact2Info; return html; } } Where Contact1...

How to do an order by not case sensitive

I'm starting to work with MongoDB and NoRM and I would like to do an orderBy that is not Ccase sensitive, is it possible? Thanks for the help! ...

How to pass ObjectId from MongoDB in MVC.net

I'm starting a new project with Mongo, NoRM and MVC .Net. Before I was using FluentNHibernate so my IDs were integer, now my IDs are ObjectId. So when I have an Edit link my URL looks like this : WebSite/Admin/Edit/23,111,160,3,240,200,191,56,25,0,0,0 And it does not bind automaticly to my controller as an ObjectId Do you have any ...

I get this error that I don't understand why, using NoRM and Mongo in my MVC project

Cannot access a disposed object. Object name: 'System.Net.Sockets.TcpClient'. I don't understand why it happen and how to deal with it. I use Ninject, my application is based on mvcstarter.codeplex.com/ what I do is delete some user or pages from my database and it happen for no reason(that I can find). Any help would be appreciated! ...

Mongo one to many relation and update problems

Hi guys, I'm implementing blog based on MongoDB. Let's look at first how Mongo guys recommend us to store blog post and its comments (http://www.mongodb.org/display/DOCS/Schema+Design): posts should be a collection. comments should be embedded objects within a post for performance. I found that it is very difficult to edit or just ...

When to use Singleton vs Transient vs Request using Ninject and MongoDB

I'm not quite sure when I should use SingletonScope() vs TransientScope() vs RequestScope() when I do my binding in my global.cs file. I have for example my call to MongoSession (using NoRM and the mvcStarter project http://mvcstarter.codeplex.com/) which is set to SingletonScope but I created a repository that use this MongoSession obj...

MongoDb NoRM Linq issue

I'm trying MongoDB with NoRM in C# and can't figure out why my LINQ queries don't work. Something as simple as this: How can this return all documents with all the fields/properties populated: return Collection.FindAll().Documents.ToList(); but this one only returns the correct number of documents with only the ID field popul...

Norm.MongoException: Connection timeout trying to get connection from connection pool

Hi, I'm using Rob's mvc startesite http://mvcstarter.codeplex.com/ with ASP.Net MVC 2, Ninject2, NoRM (http://github.com/atheken/NoRM) and MongoDB. It works so fast and the developpement is even faster but I'm facing a big problem, I at some points, get connection timeout. I can't figure out what I'm doing wrong. I already asked a que...

How to set the hilo sequence starting value in MongoDB Norm?

Hi, i imported a lot of existing values into my mongodb via the norm driver (including the "old" id - integer value). Now i got duplicate key errors from time to time. To solve this, i have to set the starting value for the hilo sequence manually. How can this be done? Thanks in advance ...

How to store nested objects in different mongodb collection?

I need to store some objects of this classes: public class Category{ public ObjectId Id {get;set;} public string Name {get;set;} public string Description {get;set;} public List<Product> Products {get;set;} } public class Product{ public ObjectId Id {get;set;} public string Name {get;set;} public string Desc...

Assembly references in Nhaml

I'm trying to get Nhaml working for an ASP.NET MVC 2 project. The backend of the project is Mongo DB, using the NoRM driver. NoRM specifies some custom types, particularly ObjectID as a reference to Mongo's unique _id column. I've got the Nhaml views compiling and outputting data from a strongly typed model, but it's choking on the Obje...

Storing a collection of IWhatever in MongoDB via NoRM

I'm having a very hard time getting this working; not even totally sure that it's possible. Let's imagine a simple scenario: class Employee { List<ITask> Tasks {get;set;} } And say we have two different implementations of tasks. If I want to save the Employee object in MongoDB as a single document (the right way to do it I think)...

Lazy loading in MongoDB with NoRM

I have a model similar to this: (simplified) Question: public class Question { public string QuestionID { get; set; } public string Title { get; set; } public string Body { get; set; } public List<Answer> Answers { get; set; } } Answer: public class Answer { public string QuestionID { get; set; } public str...