Giter VIP home page Giter VIP logo

Comments (6)

joshkopecek avatar joshkopecek commented on June 20, 2024

I believe the preferred approach would be deleting the property from the containing object rather than setting it as null. If it's null it'll think there's an object to be cast/validated.

from mongoose-geojson-schema.

cyrilchapon avatar cyrilchapon commented on June 20, 2024

I believe the preferred approach would be deleting the property from the containing object rather than setting it as null.

Well that works, but an $unset field doesn't mean the same as a null field.
null is for deliberate absence of value, not set rather means not-really-wanted absence of value.

EDIT: plus

If it's null it'll think there's an object to be cast/validated.

Yeah, that's it, I think one would want to cast null as a geojson polygon (json-type null is ok, plus it works with Object)

from mongoose-geojson-schema.

joshkopecek avatar joshkopecek commented on June 20, 2024

If you cast null as an empty GeoJSON object then it's going to want coordinate values, and if those are empty any geospatial index you have on Mongo will fail AFAIK. If the property doesn't exist it will simply be absented from the index.

from mongoose-geojson-schema.

cyrilchapon avatar cyrilchapon commented on June 20, 2024

any geospatial index you have on Mongo will fail AFAIK

Actually they are sparse by default, and null is ok with sparse indexes.

from mongoose-geojson-schema.

joshkopecek avatar joshkopecek commented on June 20, 2024

Ok I'll need to check and write a test for this. Thanks for bringing it to my attention. Obviously my knowledge of the Mongo API is a bit rusty!

from mongoose-geojson-schema.

joshkopecek avatar joshkopecek commented on June 20, 2024

@cyrilchapon I know this is late, but could you give me an example of the schema and data that you were working with? It would be nice to get this working properly with systems requiring sparse indexes.

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.