Giter VIP home page Giter VIP logo

Comments (2)

schotime avatar schotime commented on August 26, 2024

You are correct. If it has to do a map/reduce function (eg.avg, max, min, sum) then it uses javascript, which can't compare a guid because it is binary. This is the same issue if you are doing a (or, ||) comparison in which a guid is also involved.

from norm.

Salutoo avatar Salutoo commented on August 26, 2024

Hi,

How about comparing the BinData- fields ".base64()" (and optionally ".subtype()") in the query? These fields should be available from inside the javascript expressions; something like:

db.TestGuidIssue.find(function() { return this.RessourceIdentifier.base64() == "6hALHeupAkqdKI+R3k945g==" || this.Value > 1}, {Value:1})

works in my mongodb shell without problems. The base64 could be created by c# using

string.Format(""{0}"", Convert.ToBase64String(((Guid)value).ToByteArray()));

I've taken a short look at the NoRM code, but not compiled it or applied any changes myself cause I'm missing both compiler and coding tools other then notepad (^^) at the moment; but I might be able to look into this soon. Why is the Code for Guid's doing "string.Format(""{0}"", value);" anyway? Especially with the if-branch "value is ObjectId || value is Guid". Are there cases which work that way that I miss?

from norm.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.