Git Product home page Git Product logo

Comments (2)

samyakbhuta avatar samyakbhuta commented on July 1, 2024

+1 to mgd216,
Here it is assumed that the _id would be always going to be of BSON type ObjectID, which is false assumption. The assumption is made at following links, and other places as well.

Guess, one should be able to dictate using config.js ( or mongodb-rest should be able to do a smart guess) as what is the BSON type for _id field. E.g when it comes to uuid as values for _id, the BSON Binary type with subtype as UUID should be used ( See http://bsonspec.org/#/specification )

Also, node-mongodb-native already provide the support for various types. See https://github.com/christkv/node-mongodb-native/blob/master/examples/types.js#L30 and https://github.com/christkv/node-mongodb-native/blob/master/external-libs/bson/binary.cc#L21.

Please, also see the discussion regarding this issue at http://groups.google.com/group/node-mongodb-native/browse_thread/thread/73e0a02b5dd08102.

@mgd216, any specific reason why you don't want to store UUIDs as BSON Binary type with subtype UUID ? Why you have choose BSON type string to store them, it will occupy twice the space that too with indexing overhead.

from mongodb-rest.

samyakbhuta avatar samyakbhuta commented on July 1, 2024

Also, at https://github.com/tdegrunt/mongodb-rest/blob/master/lib/rest.js#L74 assuming that the _id would have equivalent hex string is not helpful for anybody who is dealing with BSON types other than ObjectIds.

from mongodb-rest.

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.