Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding GeoJSON types #66

Open
BobbieGoede opened this issue Dec 2, 2020 · 1 comment
Open

Adding GeoJSON types #66

BobbieGoede opened this issue Dec 2, 2020 · 1 comment

Comments

@BobbieGoede
Copy link

I'm trying to add a Point type to my schema which follows this format

point: { 
    type: "Point", 
    coordinates: [ 40, 5 ] 
}

I figured the following approach would work

point: Type.object().of({
    type: Type.string({ enum: ["Point"], required: true, default: "Point" }),
    coordinates: Type.array().of(Type.number()),
})

But it appears having an entry with key 'type' conflicts with ts-mongoose because it results in the following

point: {
    type: {
        type: "Point",
        coordinates: [ ]
    }
}

Is this a bug or is there another way to add GeoJSON types?

@Celleb
Copy link

Celleb commented Mar 10, 2022

See mongoose documentation https://mongoosejs.com/docs/guide.html#typeKey

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants