I’m developing a custom Smart Action where it is required to parse the query into mongo aggregation pipeline. Then I can use that pipeline to query my model.
Actually I was trying to use RecordsGetter class to get all the ids of the query by using RecordsGetter.getIdsFromRequest function, but this class requires a user object in its constructor, which I don’t have.
For the reason I don’t have this user object, we are setting up an custom authentication mechanism and this unfortunately couldn’t be changed from my side.
Observed behavior
Currently QueryBuilder class is not exported in forest-express-mongoose.
Expected behavior
forest-express-mongoose should export QueryBuilder class for a more flexible use.
Context
Agent (forest package) name & version: “forest-express-mongoose”: “^9.3.2”
Or event better, is there a way to bypass the user params of RecordsGetter class constructor?
class RecordsGetter {
constructor(model, opts, params, user) {
because we really don’t have the user param here, missing of which will cause the RecordsGetter.getIdsFromRequest to throw “Missing required user” error
Great that it works but it’s pretty weird that the user (request.user) is undefined. You are probably missing the ensureAuthenticated middleware on this route which is also weird.
Example of globally mounted ensureAuthenticatedmiddleware