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

[Fix] Projection issue, #279 #280

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions .postman/api
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
id = 787c5fe4-872e-48e3-95ec-a821c2269b7b

[relations]

[relations.collections]
rootDirectory = postman/collections

[relations.collections.metaData]

[relations.apiDefinition]
rootDirectory = postman/schemas
files[] = {"path":"index.yaml","metaData":{}}

[relations.apiDefinition.metaData]
type = openapi:3
rootFiles[] = index.yaml
7 changes: 6 additions & 1 deletion lib/mongodb-backend.js
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,13 @@ MongoDBBackend.prototype = {
this.db.collection(this.prefix + this.removeUnsupportedChar(collName),function(err,collection){
if(err instanceof Error) return cb(err);
// Excluding bucket field from search result
collection.findOne(searchParams, {_bucketname: 0},function(err, doc){
collection.find(searchParams).project({_bucketname: 0}).toArray(function(err, doc){
if(err) return cb(err);
if (doc.length) {
doc = doc[0];
} else {
return cb(undefined,[]);
}
if(! _.isObject(doc) ) return cb(undefined,[]);
doc = fixKeys(doc);
cb(undefined,_.without(_.keys(doc),"key","_id"));
Expand Down
Loading