thomas4019 / expressa

API creation middleware with an admin interface
MIT License
439 stars 27 forks source link

Mongo Projection #171

Closed kane-mason closed 2 years ago

kane-mason commented 2 years ago

I noticed in db/mongo.js that fields gets passed to the find and get mongo db commands, however according to mongo docs it expects projections property to limit fields?

kane-mason commented 2 years ago

im busy working in this area so can update it, but just wondering if i am missing something?

thomas4019 commented 2 years ago

Good catch! Looks like fields was an old parameter (that probably still works), but please update it to projection when you can. http://mongodb.github.io/node-mongodb-native/3.6/api/Collection.html#find

thomas4019 commented 2 years ago

Also, make sure to run npm run testdbs when doing these kinds of changes (that command needs local docker to be setup)

kane-mason commented 2 years ago

Fixed here https://github.com/thomas4019/expressa/pull/172

I struggled with docker and npm run testdbs. However i did manage to run both mongo and postgres tests separately and all passed