How does one represent MongoDB GeoJSON fields in a Mongoose Schema?

前端 未结 5 1596
猫巷女王i
猫巷女王i 2020-12-07 11:44

MongoDB 2.4 allows the use of GeoJSON objects and a slew of neat functions and indexes that I\'d like to use.

It expects GeoJSON objects to be stored in the format l

5条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-07 12:19

    You must used Mixed to represent arrays of arrays. There is an open ticket to support this in the future.

    @nevi_me is correct, you must declare the type property as he described.

    Here's a gist: https://gist.github.com/aheckmann/5241574

    See the mongoose tests here for more ideas: https://github.com/LearnBoost/mongoose/blob/master/test/model.querying.test.js#L1931

提交回复
热议问题