Hi,
I’m not the most familiar with Mongo nor Mongoose, but is it currently possible (or would it be possible to add) to fetch only unique (I think Mongoose has distinct
for it?) results?
Currently querying
gtfs.getStops({
within: {
lat: 59.435787,
lon: 24.750738,
radius: 0.3
}
}, {
_id: 0,
stop_name: 1,
stop_id: 1
})
.then(stops => res.json(stops))
Results in a lot of duplicated results from my GTFS:
[{"stop_id":"1634","stop_name":"Viru"},{"stop_id":"1634","stop_name":"Viru"},
{"stop_id":"1634","stop_name":"Viru"},{"stop_id":"4341","stop_name":"Viru"},
{"stop_id":"4341","stop_name":"Viru"},{"stop_id":"4341","stop_name":"Viru"},
{"stop_id":"1291","stop_name":"Viru"},{"stop_id":"1291","stop_name":"Viru"},
{"stop_id":"1291","stop_name":"Viru"},{"stop_id":"1292","stop_name":"Viru"},
{"stop_id":"1292","stop_name":"Viru"},{"stop_id":"1292","stop_name":"Viru"},
{"stop_id":"1290","stop_name":"Viru"},{"stop_id":"1290","stop_name":"Viru"},
{"stop_id":"1290","stop_name":"Viru"},{"stop_id":"1635","stop_name":"Viru"},
{"stop_id":"1635","stop_name":"Viru"},{"stop_id":"1627","stop_name":"Estonia"},
{"stop_id":"1627","stop_name":"Estonia"},{"stop_id":"1627","stop_name":"Estonia"},
{"stop_id":"1630","stop_name":"Estonia"},{"stop_id":"1630","stop_name":"Estonia"},
{"stop_id":"1630","stop_name":"Estonia"},{"stop_id":"1628","stop_name":"Estonia"},
{"stop_id":"1628","stop_name":"Estonia"},{"stop_id":"1628","stop_name":"Estonia"},
...]
Issue Analytics
- State:
- Created 6 years ago
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Unique Definition & Meaning - Merriam-Webster
The meaning of UNIQUE is being the only one : sole. How to use unique in a sentence. Can something be very unique...
Read more >72 Synonyms & Antonyms for UNIQUE - Thesaurus.com
unique · adj.alone, singular · adj.one-of-a-kind; without equal ...
Read more >Unique Definition & Meaning - Dictionary.com
existing as the only one or as the sole example; single; solitary in type or characteristics: a unique copy of an ancient manuscript....
Read more >Meaning of unique in English - Cambridge Dictionary
being the only existing one of its type or, more generally, unusual or special in some way: Each person's DNA is unique. uniquely....
Read more >unique - Wiktionary
(not comparable) Being the only one of its kind; unequaled, unparalleled or unmatched. quotations ▽synonyms △ · Of a feature, such that only...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Thanks for your patience. I was able to find the issue.
The issue was that your project has specified a different version of mongoose from the one one specificed by node-gtfs. In your
package.json
file it calls for mongoose 5.0.6, but node-gtfs specifics 5.0.9. This was causing two versions to get installed, and causing errors on import.The way to fix this is to specify
in your package.json. Delete your
node_modules
folder andpackage-lock.json
and runnpm install
again. You can check in node_modules/gtfs/node_modules to make sure a second version of mongoose isn’t getting installed.Interesting, rimraffing
node_modules
and package-lock didn’t do the trick with1.5.3
, but worked fine with1.6.0
. Also all the stops are now unique (most likely since I don’t have to runskip-delete
anymore, which might have caused the issue earlier : )Thank you so much @brendannee for the constant support!