reactjs - How do i get $facet to work in reactfeatherjs? - Stack Overflow

i cant get this query to work:<PaginatedCollectionservice="users"query={{$facet: {members

i cant get this query to work:

<PaginatedCollection
        service="users"
        query={{
          $facet: {
            membersFirst: [
              { $addFields: { isMember: { $in: ["$_id", team.members || []] } } },
              { $sort: { isMember: -1, createdAt: -1 } }
            ]
          }
        }}
        table={MemberTable}
        tableOptions={{ user, translate, languages }}
        filter={(query, value) => (query.email = { $regex: value })}
        filterPlaceholder={"Filter by email"}
      />

Im fairly new to featherjs and react so the problem might be obvious, but it keeps saying Invalid parameter. this is the service in the backend:

// Initializes the `users` service on path `/users`
const { Users } = require("./users.class");
const createModel = require("./users.model");
const hooks = require("./users.hooks");

module.exports = function(app) {
  const options = {
    Model: createModel(app),
    paginate: app.get("paginate"),
    query: {
      $sort: true,
      $skip: true,  
      $limit: true,
      $facet: true  
    }
  };

  // Initialize our service with any options it requires
  app.use("/users", new Users(options, app));

  // Get our initialized service so that we can register hooks
  const service = app.service("users");

  service.hooks(hooks);
  service.publish((data, context) => {
    return app.channel(`users/${data._id}`, `users/${data.coachId}`, `admins`);
  });
};

what i wanna achieve is to show all the users, but show the team members first

I tried to enable the $ parameters, thinking thats why it says its invalid but still didnt work, not sure what else to do

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744705956a4589057.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信