Code Monkey home page Code Monkey logo

Comments (5)

markstos avatar markstos commented on August 28, 2024

I see what you mean. I'm not sure what risk there is of collisions now, but certainly using GeoJSON as the top-level Schema element would be very-low risk.

If you wanted to go ahead and refactor a 2.0 release soon, I doubt many people have had a chance to adopt the 1.0.x syntax.

As long the amount of syntax people need is similar and we get clear diagnostic messages, I'm in favor of the change.

from mongoose-geojson-schema.

joshkopecek avatar joshkopecek commented on August 28, 2024

Yes, I'll see what I can do. I don't foresee a major change in the codebase to implement this.

from mongoose-geojson-schema.

joshkopecek avatar joshkopecek commented on August 28, 2024

Done. v2.0.0 is out.

from mongoose-geojson-schema.

markstos avatar markstos commented on August 28, 2024

From the README, it appears the validation just got weaker. Here's an example of the new syntax:

  point: mongoose.Schema.Types.GeoJSON,

Before, a point could be validated as a GeoJSON Point. Is the new syntax looks like it would allow /any/ valid GeoJSON object to be used where only a point was expected. Is that the case?

I was expecting a syntax more like one of these:

 point: mongoose.Schema.Types.GeoJSON.Point,
// OR
 point: mongoose.Schema.Types.GeoJSON({ type: Point })

In 2.0, how would specify that I wanted a field to be validated as GeoJSON Point?

from mongoose-geojson-schema.

joshkopecek avatar joshkopecek commented on August 28, 2024

@markstos You're absolutely right. Too tired to notice that glaring omission.

Mongoose doesn't allow nested schemas, so I've readded the v1.0 types to the Types. I've kept the GeoJSON type in case anyone wants to be flexible about the type they're using.

from mongoose-geojson-schema.

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.