TylerBrock / mongo-hacker

MongoDB Shell Enhancements for Hackers
tylerbrock.github.io/mongo-hacker
MIT License
1.79k stars 235 forks source link

filter is not a function #196

Closed kagahd closed 5 years ago

kagahd commented 6 years ago

Classic findOne() works:

mongo-seometadata-01(mongos-3.4.15)[mongos] seo-metadata> db.oopmetadata.findOne()
{
  "_id": {
    "siteId": NumberLong("10"),
    "productId": NumberLong("3395201")
  },
  "index": false,
  "lastModified": ISODate("2018-09-14T12:22:12.070Z")
}

But filter() wont work:

mongo-seometadata-01(mongos-3.4.15)[mongos] seo-metadata> db.oopmetadata.filter()
2018-09-14T15:44:42.755+0200 E QUERY    [js] TypeError: db.oopmetadata.filter is not a function :
@(shell):1:1

My mongo shell is v4.0.0, perhaps that's the reason that something is incompatible with it.

stennie commented 5 years ago

Adding collection.filter() as an alias for collection.find() doesn't seem constructive. I'm not sure if this existed previously, but I've removed the mention from the README.