Giter Club home page Giter Club logo

Comments (2)

emredalkiran avatar emredalkiran commented on September 4, 2024

@dashersw I have a question regarding how to retrieve data types. From the screenshot you posted, I assume that we need BSON data types. mongoose does not provide a way of accessing underlying BSON data types. I also couldn't find a way to access these data types via the native driver. MongoDB has an extended JSON spec (https://github.com/mongodb/specifications/blob/master/source/extended-json.rst) but that seems to work more on the inserting or filtering part of queries, rather than evaluating a find query result. I've tried to use BSON parser (https://www.npmjs.com/package/bson#EJSON), which supports extended json deserialization but I couldn't get the underlying BSON types from that either.

from mogollar.

dashersw avatar dashersw commented on September 4, 2024

Oh I wasn't worried about BSON data types — but for each property we print, we should check whether they are boolean, string, number, Date, ObjectId, Array or Object. I found for object id's one can do record._id._bsontype and it returns ObjectID. For others, regular typeof checks (or Array.isArray and so on) should be enough?

from mogollar.

Related Issues (17)

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.