Coder Social home page Coder Social logo

GeoJSON Support about typegoose HOT 4 CLOSED

szokodiakos avatar szokodiakos commented on August 20, 2024
GeoJSON Support

from typegoose.

Comments (4)

naorzr avatar naorzr commented on August 20, 2024 4

@hasezoey honestly it works just fine for the queries OP specified.

defining class like in the example you brought

@index({ location: '2dsphere' })
export class Rating extends Typegoose {
  @prop({ ref: Car })
  public car: Ref<Car>;

  @prop({ ref: User })
  public user: Ref<User>;

  @prop()
  public stars: number;

  @arrayProp({ items: Array })
  public location: [[number]];
}

and doing query search with $nearSphere.

from typegoose.

hasezoey avatar hasezoey commented on August 20, 2024 1

currently in the tests is

@index({ location: '2dsphere' })

and
@arrayProp({ items: Array })
public location: [[number]];

i dont know if this "fixes" the full issue here...

from typegoose.

szokodiakos avatar szokodiakos commented on August 20, 2024

Hello. This could happen because of two reasons:

  • To define an index required for geoJSON you must use schema wise index definition (?). If this is the case, so no line index can be used (when defining the schema) then this is currently not supported by Typegoose, however schema-level index definition is a requested feature so it will likely be developed if I have the time (#43).
  • If it can be defined using prop-level index (like you did in the example), it is clearly a bug in Typegoose as the code should work.

Either way research must be made about geoJSON index (can it be defined in the schema property when using pure Mongoose). If it is possible then the bug must be eliminated in Typegoose.

Both researching and PRs are greatly appreciated, if you have the time. Otherwise when I'll have the time will look into it.

from typegoose.

hasezoey avatar hasezoey commented on August 20, 2024

i think this can now be closed as "solved"

@Ben305

from typegoose.

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.