atheken / norm Goto Github PK
View Code? Open in Web Editor NEWNoRM is a MongoDB driver for .Net designed to provide access to strongly/statically-typed documents and collections.
License: BSD 3-Clause "New" or "Revised" License
NoRM is a MongoDB driver for .Net designed to provide access to strongly/statically-typed documents and collections.
License: BSD 3-Clause "New" or "Revised" License
Offen I need to store document with not supported types (TimeSpan,CultureInfo,other)
It will be nice to have ability to set type mappers to/from BSON type
for example:
TimeSpan -> BSON = TimeSpan.Ticks
CultureInfo -> BSON = CultureInfo.GetWebName()
Hello, i am having an issue when trying to authenticate with a database. I have started the mongod server with --auth, i have set up the user for the admin database and the user for my database.
Now, i am trying to connect with:
_mongo= new Mongo("dbname", "user:pass@localhost", "27017", "");
Everything works normally when authenticating from the command line. However, when authenticating with NoRM, i get two alternating exceptions:
db assertion failure [MongoException: db assertion failure] Norm.BSON.BsonDeserializer.HandleError(String message) +34 Norm.BSON.BsonDeserializer.ReadObject(Type type) +212 Norm.BSON.BsonDeserializer.DeserializeValue(Type type, BSONTypes storedType, Object container) +706 Norm.BSON.BsonDeserializer.Read(Int32 length) +74 Norm.BSON.BsonDeserializer.Deserialize(BinaryReader stream, Int32 length) +72 Norm.BSON.BsonDeserializer.Deserialize(Int32 length, BinaryReader reader, IDictionary`2& outProps) +47 Norm.Protocol.Messages.ReplyMessage`1..ctor(IConnection connection, String fullyQualifiedCollestionName, BinaryReader reply, MongoOp originalOperation, Int32 limit) +328 Norm.Protocol.Messages.QueryMessage`2.Execute() +543 Norm.ConnectionProvider.Authenticate(IConnection connection) +370 Norm.ConnectionProvider.CreateNewConnection() +106 Norm.PooledConnectionProvider.Open(String options) +256 Norm.Mongo.ServerConnection() +23 Norm.Mongo..ctor(String db, String server, String port, String options) +104
and
unauthorized for db [dbname] lock type: -1 [MongoException: unauthorized for db [dbname] lock type: -1 ] Norm.BSON.BsonDeserializer.HandleError(String message) +34 Norm.BSON.BsonDeserializer.ReadObject(Type type) +212 Norm.BSON.BsonDeserializer.DeserializeValue(Type type, BSONTypes storedType, Object container) +706 Norm.BSON.BsonDeserializer.Read(Int32 length) +74 Norm.BSON.BsonDeserializer.Deserialize(BinaryReader stream, Int32 length) +72 Norm.BSON.BsonDeserializer.Deserialize(Int32 length, BinaryReader reader, IDictionary`2& outProps) +47 Norm.Protocol.Messages.ReplyMessage`1..ctor(IConnection connection, String fullyQualifiedCollestionName, BinaryReader reply, MongoOp originalOperation, Int32 limit) +328 Norm.Protocol.Messages.QueryMessage`2.Execute() +543 Norm.d__0.MoveNext() +103 System.Linq.Enumerable.FirstOrDefault(IEnumerable`1 source) +215 Norm.Linq.MongoQueryProvider.ExecuteQuery(Expression expression) +1469 Norm.Linq.MongoQueryProvider.System.Linq.IQueryProvider.Execute(Expression expression) +52 System.Linq.Queryable.FirstOrDefault(IQueryable`1 source) +269
Am i doing something wrong here or is it a bug with the NoRM driver?
I get the exception: The connection string passed does not appear to be a valid Uri, it should be of the form: 'mongodb[rs]://[user:password]@host:[port]/[replicaSetName]/dbname?[options]' where the parts in brackets are optional.
The problem is that my connection string contains a #
I use "Contains" in linq, Norm report "Subqueries with Contains are not currently supported".
So i try to use PredicateBuilder (http://www.albahari.com/nutshell/predicatebuilder.aspx) to build expression myself, but i found Where(o => true) always return empty result.
NoRM can't be referenced from a strongly named assembly right now since it doesn't have a strong name key and is not signed. Could you please create a key so that it can be signed.
When performing the following query which i know real result count I get fewer results than expected.
string[] ids = {"", "", ... };
collection.Find( new { _id = Q.in( ids ));
if my list of ids was 8222, i might only get back 789 records. To me this seems to be a big bug. I had to resort to retrieving records in batches of 100 at a time.
Using Newtonsoft Json library to write a BSON byte array in SpeedTest is 10x to 15x faster than the current BSON serializer (with a gotcha: Newtonsoft library serializes Guids as string, but it's easy to make a custom serializer for it).
All properties of an Expando is serialized using SerializeMember. This in turn does not call WriteDocument, but only WriteObject, which means any inner Expando objects are serialized as "real" objects. This again means deserialization fails.
This is not an issue for me, and apparently not any one else, so maybe it's not that important?
See http://www.mongodb.org/display/DOCS/Optimization#Optimization-Explain
(putting this in so we don't forget later; doesn't seem like a v1 thing to me)
I'll like to see a way to create 2d index and also a way to select using the MongoDb $near function.
Given a class to be persisted using Norm that in its static constructor declares the column aliases as shown in your examples in http://wiki.github.com/atheken/NoRM/configuration, when I save the class everything goes ok, fields are persisted to the database using the aliases. Unfortunately, when I load the class from the database, an exception throws because there is no property in the class named as the alias. E.g., if I have a column named "foo" and I set its alias to "bar", when I save the object, the column is named "bar" in the database. But when I load the object from the database (i.e., using Find()), an exception says that there is no property named "bar" in the object.
I was trying to store an instance of CultureInfo. The BSON serializer crashed with a stack overflow due to the fact that CultureInfo has a Parent property which refers to itself, thereby making a circular reference.
A CultureInfo can be stored as a simple string like "en-US".
There must be a ton of simple value objects like this that cannot immediately be serialized even though they have a simple string representation. I suggest some kind of plugin structure where one can add "tostring" serializers (or more generic serializers) for certain objects. The class mapping is not really good enough here.
We don't currently deal with concurrency at all in the driver, this should be dealt with.
Apart from unlocking GridFS functionality of MongoDB for C#, having GridFS support works well as a workaround for BSON's 4MB limit
when i upload a file, i found the GridFS didn't save the file content in CachedChunks. See the code i modify, i don't kown how the MongoDB save the file in chunk, is it need add FileChunk into CachedChunks?
in the GridFile.cs,
do
{
var binary = value.Skip(cursor)
.Take(this.ChunkSize).ToArray();
takeCount = binary.Length;
cursor += takeCount;
if (takeCount > 0)
{
var c = new FileChunk();
c.ChunkNumber = chunkNumber;
c.FileID = this.Id;
c.BinaryData = binary;
// this.CachedChunks.Add(c); <-- here i add this line, it works.
chunkNumber++;
}
} while (takeCount > 0);
There seems to be no way to tell the BSON serializer that it should ignore certain properties.
Im using a database named like ti24horas.com.
When i tried to insert a new object into mongodb, the application locks up in a loop waiting for receive data and in server side an exception is thrown.
The workaround for me was rename the database to ti24horas
When I try to use an instance of Regex in the predicate of my Linq expression, I get ArgumentOutOfRangeException
. Whereas there should be the following exception:
throw new NotSupportedException(string.Format("Only the static Regex.IsMatch is supported.", m.Method.Name));
Any plans to allow something like this?
var linq = new List<Predicate> { c => c.OwnerId== criteria.OwnerId, };
if (criteria.Status.HasValue)
linq.Add(c => c.StatusCd == criteria.Status.Value);
if (!string.IsNullOrEmpty(criteria.Source))
linq.Add(c => c.Source == criteria.Source);
Expression<Func<Client, bool>> where = p => linq.All(pred => pred(p));
return Session.All<Client>().Where(where).OrderByDescending(c => c.ModifiedDt).ToList();
I think there is a problem with the (MongoCollectionGeneric) Save(T entity).
nullable int and longs are directed to Insert flow instead of update.
The expression:
if (id == null &&
(typeof(ObjectId).IsAssignableFrom(idProperty.Type)) ||
(typeof(long?).IsAssignableFrom(idProperty.Type)) ||
(typeof(int?).IsAssignableFrom(idProperty.Type)) )
is problematic since Long? and int? are always entering - whether if null or not.
Solution: () should be added over all || cases.
It is entirely possible that more than one host in a ReplicaSet may be down at any point (for maintenance, server crash, etc.). The Connection string should follow the form used in the 10gen driver (http://www.mongodb.org/display/DOCS/CSharp+Driver+Tutorial#CSharpDriverTutorial-Connectionstrings) of allowing multiple hostnames to be specified (separated by commas) which will each be queried until one responds. This allows the first server to be down, but the second one/third one to work.
Thanks.
I'm trying to do the following:
var collection = m.GetCollection<Post>()
.AsQueryable().ToList();
However, this throws an ArgumentOutOfRangeException:
Non-negative number required.
Parameter name: count
Am I doing something wrong...?
Stack Trace:
at Norm.BSON.BsonDeserializer.Deserialize[T](BinaryReader stream, Int32 length) in C:\Users\alexb\Downloads\atheken-NoRM-v0.9.8-4-gd8faa81\atheken-NoRM-d8faa81\NoRM\BSON\BsonDeserializer.cs:line 102
at Norm.BSON.BsonDeserializer.Deserialize[T](Int32 length, BinaryReader reader, IDictionary2& outProps) in C:\Users\alexb\Downloads\atheken-NoRM-v0.9.8-4-gd8faa81\atheken-NoRM-d8faa81\NoRM\BSON\BsonDeserializer.cs:line 76 at Norm.Protocol.Messages.ReplyMessage
1..ctor(IConnection connection, String fullyQualifiedCollestionName, BinaryReader reply, MongoOp originalOperation, Int32 limit) in C:\Users\alexb\Downloads\atheken-NoRM-v0.9.8-4-gd8faa81\atheken-NoRM-d8faa81\NoRM\Protocol\Messages\ReplyMessage.cs:line 60
at Norm.Protocol.Messages.QueryMessage2.Execute() in C:\Users\alexb\Downloads\atheken-NoRM-v0.9.8-4-gd8faa81\atheken-NoRM-d8faa81\NoRM\Protocol\Messages\QueryMessageGeneric.cs:line 119 at Norm.MongoQueryExecutor
3.d__0.MoveNext() in C:\Users\alexb\Downloads\atheken-NoRM-v0.9.8-4-gd8faa81\atheken-NoRM-d8faa81\NoRM\MongoQueryExecutor.cs:line 74
at System.Collections.Generic.List1..ctor(IEnumerable
1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
at MongoTest.Program.justGetTitles() in C:\Users\alexb\Desktop\New folder\MongoTest\MongoTest\Program.cs:line 112
at MongoTest.Program.Main(String[] args) in C:\Users\alexb\Desktop\New folder\MongoTest\MongoTest\Program.cs:line 27
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
If following code is used to create GridFile resulting file will be invalid.
var file = new GridFile()
{
Content = content,
Id = Norm.ObjectId.NewObjectId(),
UploadDate = DateTime.Now,
FileName = filename,
ContentType = contentType
};
mongoDb.Files().Save(file);
Reason is that when Content is set autogenerated Id is used. Then Id is changed which result that file and chunks are not related anymore.... Id change should be forbidden after content is set, or all chunks should be updated to use new Id.
It's not a big issue, but it took me a few hours and forced me to debug norm code :)
BTW, great lib ...
NORM cannot handle expressions where the type is an interface type.
For example, in a generic class that has an interface constraint on the type, when I access a property of T, e.g. ".UniqueIdentifier" NORM cannot handle the expression and an Exception is thrown (relating to its inability to case a UnaryExpression to a ParameterExpression).
var existing = db.GetCollection<T>().AsQueryable().SingleOrDefault(x => x.UniqueIdentifier == uid);
In this expression 'x.UniqueIdentifier' has a NodeType=Convert wrapped around it to perform the cast to the interface.
It's actually a fairly simple fix: In MongoQueryTranslator.cs, about line 407 there is an if statement in ...
private static ParameterExpression GetParameterExpression(Expression expression)
Adding the following clause to the if statement solves the problem:
...
else if (parentExpression.NodeType == ExpressionType.Convert)
{
parentExpression = ((UnaryExpression)parentExpression).Operand;
expressionRoot = parentExpression is ParameterExpression;
}
When i call Count() method from IQueryable interface without query parameters, the server throws the following assertion:
server log with(-vvvv specified):
Thu Jul 01 20:46:04 run command databasetest.$cmd { query: { count: "Product", query: {} } }
Thu Jul 01 20:46:04 query galeriadoamor.com.$cmd ntoreturn:1 0ms
Thu Jul 01 20:46:04 Assertion failure toSend.data util\message.cpp 380
Thu Jul 01 20:46:04 AssertionException in connThread, closing client connection
The code i tested is:
long count = db.GetCollection().FindAll().Count();
The class description is pasted below:
public class Product
{
[MongoIdentifier]
public int? ID { get; set; }
public List AvailableDescriptions { get; set; }
public double Weight { get; set; }
public string InternalName { get; set; }
}
public class ProductDescription
{
public string Language { get; set; }
public string Description { get; set; }
public string CompleteDescription { get; set; }
public double Price { get; set; }
public List<ProductFeature> Features { get; set; }
public double AdditionalWeight { get; set; }
public double PackageWeight { get; set; }
public ProductStatus ProductStatus { get; set; }
}
public class ProductFeature
{
public string FeatureName { get; set; }
public List<FeatureOption> Options { get; set; }
}
public class FeatureOption
{
public string Description { get; set; }
public decimal AdditionalPrice { get; set; }
public string Type { get; set; }
}
I get the following exception when trying to do a rather complex query:
Unable to cast object of type 'System.Linq.Expressions.BinaryExpression'
to type 'System.Linq.Expressions.MemberExpression'.
Query: var result =
Context.Query<Subscription>().
Where(s => s.LastReportTicks + s.Interval * TicksPerDay < NowTicks).
OrderBy(s => s.LastReportTicks + s.Interval * TicksPerDay);
at Norm.Linq.MongoQueryTranslator.HandleSort(Expression exp, OrderBy orderby)
in MongoQueryTranslator.cs
The cast to (MemberExpression) assumes there's only a simple member access... I fiddled around a bit, but I was unable to fix this so far.
db.$cmd.findOne({serverStatus:1})
{
"uptime" : 275387,
"globalLock" : {
"totalTime" : 275386956000,
"lockTime" : 1300000,
"ratio" : 0.000004720630268341395
},
"mem" : {
"resident" : 2,
"virtual" : 887,
"supported" : true,
"mapped" : 848
},
"ok" : 1
}
(just putting this in so I don't forget)
Updates should only alter properties that are defined on the document, and should leave other properties untouched when updating.
Hi,
Seems that there is a bug with using Guid in the map function when doing MapReduce.
If I try to do this.query.Where(c => c.RessourceIdentifier = myGuid).Average(c => c.Value) I get no result if RessourceIdentifier is a Guid.
It works if RessourceIdentifier is a numeric.
Maybe it's because a Guid is stored as binary data in mongodb and in the map function you try to match the Guid as a string.
public class TestGuidIssue
{
public Guid RessourceIdentifier { get; set; }
public int Value { get; set; }
}
support for these would be nice.
The following method will crash with an NotSupportedException("The constant for 'byte[]' is not supported") thrown at MongoQueryTranslator.cs:699. Any chance to get this to work or is this a limitation of MongoDb or BSON?
public Guid? GetUserIdByUsernamePassword(string Username, byte[] Password)
{
using (var db = ServiceLocator.Get())
{
var users = db.GetCollection();
var user = users.AsQueryable().Where(x => x.Username == Username && x.Password == Password).FirstOrDefault();
if (user == null)
return null;
return user.Id;
}
}
See http://www.mongodb.org/display/DOCS/Optimization#Optimization-Hint
(putting this in to track it; this is probably a v2, not a v1 IMHO)
Currently the class reads thus:-
/// <summary>
/// The map reduce result.
/// </summary>
/// <typeparam retval="T">Type to map and reduce</typeparam>
public class MapReduceResult<T>
{
/// <summary>
/// Gets or sets Id.
/// </summary>
public int Id { get; set; }
/// <summary>
/// Gets or sets Value.
/// </summary>
public T Value { get; set; }
}
If instead it was like this it could handle all MapReduce results:
/// <summary>
/// This is a useful type for dealing with MapReduce results.
/// It takes two type parameters, one for the key and one for the value.
/// The simplest possible result would use type parameters ObjectId and int
/// </summary>
public class MapReduceResult2<Tid, Tvalue>
{
public Tid _id { get; set; }
public Tvalue value { get; set; }
public override string ToString()
{
return string.Format("{0} {1}", _id, value);
}
}
Suggest either replacing it with the more flexible version or making it internal so it's not exposing a class that has no use outside NORM.
Andrew,
I added a gem for NoRM 0.9.7 to rubygems.org. If you're interested in keeping it updated let me know the email address associated with your rubygems.org account and I can add you as an owner. I'm starting to use nu (The gem tool for .NET: http://bit.ly/dvd7gJ) and wanted to make this available via that mechanism.
Here is the rake task I used to generate the gem if your interested: http://gist.github.com/504594
Thanks!
m
Json.Net is powerfull and customizable product. Can you add support for Json.Net as pluggable serializer?
Due to a caching system that I've implemented on top of Norm, I need to serialize Mongo records using system serializers. Unfortunately, I've had to manually modify the ObjectId type (the one I use right now) to add the [Serializable] attribute and allow, then, the record to be serialized.
I think that in-record data types should be serializable by default.
When a field is added to the document and the object does not have this property, first, an OutOfmemoryException is thrown, then various errors occurs in other object deserialization that is not related with the first.
The workaround is remove the field from mongodb, then reset the pooled connections.
How to reproduce:
First I need to say, this project is absolutely fantastic piece of work.
Maybe I can start helping a little bit. I was looking for 'Geospatial Index' support in Norm, I found a fork from 'hafstrom' and commit related to this subject.
I may be wrong, but this commit was not merged?
The last commit was http://github.com/hafstrom/NoRM/commit/220042f0cb8e9696a0c8a3b31e31d3cbbba50c6d
Please take a look on it.
Thanks!!!
When using the attribute [MongoDiscriminated] on a generic class, the type string return by ReflectionHelper.GetTypeDiscriminator() is truncated and not valid which lead to an exception when using it in Type.GetType().
With the following code :
class Program
{
[Norm.MongoDiscriminated]
class Error<T>
{ }
static void Main(string[] args)
{
var helper = new Norm.BSON.ReflectionHelper(typeof(Error<int>));
Console.WriteLine(helper.GetTypeDiscriminator());
}
}
I get the following type :
test.norm.Program+Error`1[[System.Int32, mscorlib
When the valid type would have been :
test.norm.Program+Error`1[[System.Int32, mscorlib]], test.norm
I'm using NoRM from a month ago and tried to implement everything I needed on my own classes instead of customizing the library (I consider modifying third-party code is a bad practice).
Now I've found I need to use a custom data type that should serialize to a primitive type. E.g., i want a "UnixTime" class that stores to the DB as a long, e.g.:
class MiClass {
public ObjectId _id { get; set; }
public UnixTime time { get; set; }
}
In the database, I don't want to store a "time: { seconds: 0 }", instead I want "time: 0".
To do that I should modify the BSONSerializer and BSONDeserializer classes, or to create an ignored property to work with UnixTime, then a property of type long with the long value for the UnixTime.
I think should be cool if NoRM supports at least one of those:
Any ideas why this exception is thrown every ~5 minutes?
[MongoException: Connection timeout trying to get connection from connection pool]
Norm.PooledConnectionProvider.Open(String options) in D:\Coding\DotNet\OS\NoRM\NoRM\Connections\PooledConnectionProvider.cs:62
Norm.Mongo.ServerConnection() in D:\Coding\DotNet\OS\NoRM\NoRM\Mongo.cs:189
Norm.Mongo..ctor(String db, String server, String port, String options) in D:\Coding\DotNet\OS\NoRM\NoRM\Mongo.cs:90
Norm.Mongo..ctor(String db) in D:\Coding\DotNet\OS\NoRM\NoRM\Mongo.cs:44
Given the class
public class Note {
public Note() {
Tags = new List<string>();
}
public ObjectId Id { get; set; }
public string Title { get; set; }
public string Body { get; set; }
public List<string> Tags { get; set; }
}
I am getting an exception when I run the following LINQ statement
return mongo.GetCollection<Note>().AsQueryable().Where(x => x.Tags.Contains(_tag));
[ArgumentNullException: Value cannot be null.
Parameter name: source]
System.Linq.Enumerable.Cast(IEnumerable source) +730580
Norm.Linq.MongoQueryTranslator.HandleContains(MethodCallExpression m) in C:\Projects\NoRM\NoRM\Linq\MongoQueryTranslator.cs:1041
Norm.Linq.MongoQueryTranslator.VisitMethodCall(MethodCallExpression m) in C:\Projects\NoRM\NoRM\Linq\MongoQueryTranslator.cs:847
Norm.Linq.ExpressionVisitor.Visit(Expression exp) in C:\Projects\NoRM\NoRM\Linq\ExpressionVisitor.cs:70
Norm.Linq.MongoQueryTranslator.VisitPredicate(Expression expr, Boolean IsNotOperator) in C:\Projects\NoRM\NoRM\Linq\MongoQueryTranslator.cs:378
Norm.Linq.MongoQueryTranslator.HandleWhere(Expression exp) in C:\Projects\NoRM\NoRM\Linq\MongoQueryTranslator.cs:1035
Norm.Linq.MongoQueryTranslator.TranslateToWhere(MethodCallExpression exp) in C:\Projects\NoRM\NoRM\Linq\MongoQueryTranslator.cs:1022
Norm.Linq.MongoQueryTranslator.HandleMethodCall(MethodCallExpression m) in C:\Projects\NoRM\NoRM\Linq\MongoQueryTranslator.cs:1154
Norm.Linq.MongoQueryTranslator.VisitMethodCall(MethodCallExpression m) in C:\Projects\NoRM\NoRM\Linq\MongoQueryTranslator.cs:841
Norm.Linq.ExpressionVisitor.Visit(Expression exp) in C:\Projects\NoRM\NoRM\Linq\ExpressionVisitor.cs:70
Norm.Linq.MongoQueryTranslator.Translate(Expression exp, Boolean useScopedQualifier) in C:\Projects\NoRM\NoRM\Linq\MongoQueryTranslator.cs:101
Norm.Linq.MongoQueryProvider.ExecuteQuery(Expression expression) in C:\Projects\NoRM\NoRM\Linq\MongoQueryProvider.cs:103
Norm.Linq.MongoQuery`1.GetEnumerator() in C:\Projects\NoRM\NoRM\Linq\MongoQuery.cs:123
System.Linq.Enumerable.Count(IEnumerable`1 source) +177
I have the following set up. 4 shards, 3 config servers, and 1 router server. NoRM does not function correctly in this situation which is a real world like set up. In my testing the NoRM driver connects through the "mongos" process instead of connecting to the "mongod" process. If I run the unit test against a single "mongod" database everything works great. If i run the unit test against the production set up, tons of tests fail. While the library is awesome, it really came as a surprise that it seems that it has never been tested in a production like set up. I really hope this is something that is fixed soon.
During my work with the configuration code, I found this piece in MongoConfigurationMap.cs:
public string GetPropertyAlias(Type type, string propertyName)
{
var map = MongoTypeConfiguration.PropertyMaps;
var retval = propertyName;//default to the original.
if (IsIdPropertyForType(type, propertyName) && !IsDbReference(type))
{
retval = "_id";
}
else if (map.ContainsKey(type))
{
foreach (var m in map.Keys)
{
// Might find a property with same name, but in other type???
if (map[m].ContainsKey(propertyName))
{
retval = map[m][propertyName].Alias;
break;
}
}
}
return retval;
}
I believe the highlighted "foreach" section is wrong. I would expect:
public string GetPropertyAlias(Type type, string propertyName)
{
var map = MongoTypeConfiguration.PropertyMaps;
var retval = propertyName;//default to the original.
if (IsIdPropertyForType(type, propertyName) && !IsDbReference(type))
{
retval = "_id";
}
else if (map.ContainsKey(type))
{
var properties = map[type];
if (properties.ContainsKey(propertyName))
{
retval = properties[propertyName].Alias;
break;
}
}
return retval;
}
Does norm support complex group by in linq, such as
db.GetCollection<Action>().AsQueryable().Where(...)
.GroupBy(o => (o.UtcActionTime + timeOffset).Date).Select(...)
Norm.ConnectionProviderFactory is not multithread safe. (but pretends to be :) It has a double lock pattern that will not work since _cachedBuilders's TryGetValue() is not an atomic operation. i.e. TryGetValue() (outside the lock) might be running at the same time as Add() on the same dictionary. A simple solution is copy on write.
If I have a document class with a composite Id (i.e. using a custom class) and I access the Id property in the IQueryable.Where method for the associated collection, the property is not aliased correctly. Example:
class CustomerId
{
public string Type { get; set; }
public int SeqNum { get; set; }
}
class Customer
{
public CustomerId Id { get; set;}
public string Name { get; set;}
}
var x = database.GetCollection().AsQueryable().Where(c => c.Id.Type == "Premium");
It would be nice to be able to ensure that indexes get created in the background as described on: http://www.mongodb.org/display/DOCS/Indexes#Indexes-BackgroundIndexBuilding Would it be as simple as creating a new property on MongoIndex and then mapping that to the underlying request?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.