PR Feedback fixes

This commit is contained in:
Derrick Mehaffy 2019-03-29 06:58:32 -07:00
parent b08c5bf3d2
commit 73f215f0ba
3 changed files with 6 additions and 4 deletions

View File

@ -50,13 +50,13 @@ or
##### Or clauses
If you use the same operator (except for in and nin) the values will be use to build and `OR` query
If you use the same operator (except for in and nin) the values will be use to build an `OR` query
`GET /posts?title_contains=article&title_contains=truc`
### Deep filtering
Find posts written by a user who belongs to a company with the name equal to strapi
Find posts written by a user who belongs to a company with the name equal to Strapi
`GET /posts?author.company.name=strapi`
::: note
@ -180,7 +180,7 @@ If you are using a mongo database calling `buildQuery` returns either a [`Mongoo
##### Custom Query
When using the deep filtering feature with mongo, we build an aggregation query to avoid too many round-trips with the mongo DB.
Doing that means we don't get a Mongoose object andin return bu a plain JS Object. This brings a lot of issues like no virtual fields available and not Mongoose lifecycles etc.
Doing that means we don't get a Mongoose object and instead it returns a plain JS Object. This brings a lot of issues like no virtual fields available and not Mongoose life cycles etc.
To give the best experience possible, we decided to rehydrate the Mongoose models, forcing us to override the Mongoose query

View File

@ -71,7 +71,7 @@ module.exports = (mongoose = Mongoose) => {
}
// Here we don't use mongoose.Types.ObjectId.isValid method because it's a weird check,
// it returns for instance true for any integer value ¯\_(ツ)_/¯
// it returns for instance true for any integer value
const hexadecimal = /^[0-9A-F]+$/i;
return hexadecimal.test(value) && value.length === 24;
},

View File

@ -1,3 +1,5 @@
'use strict';
/**
* Aggregator.js service
*