admin管理员组

文章数量:1395780

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

本文标签: reactjsHow do i get facet to work in reactfeatherjsStack Overflow