Coder Social home page Coder Social logo

Comments (8)

mazero avatar mazero commented on May 8, 2024 2

_limit = -1 is equal to unlimited @JohnnyK84

from strapi-plugin-import-export-content.

carediary avatar carediary commented on May 8, 2024

I am also experiencing the same "We can import and export data but when we want to export more than 100 entries, we can't. (issue)"

from strapi-plugin-import-export-content.

JohnnyK84 avatar JohnnyK84 commented on May 8, 2024

Just installed this plugin and we have the same problem for exporting. By default we are only getting 100 entries back. Anyone find a work around to fix this?

from strapi-plugin-import-export-content.

JohnnyK84 avatar JohnnyK84 commented on May 8, 2024

I would say the cap of 100 in the response is due to Strapis default return _limit which is 100 by default.
This can be seen in the Swagger documentation when running a get on the same API (only 100 results returned). Adjusting the _limit parameter returns more results.
So I guess to fix the _limit parameter on the query which exports the data should include a _limit amount. Unfortunately I don't know where in the code to set this param.

from strapi-plugin-import-export-content.

JohnnyK84 avatar JohnnyK84 commented on May 8, 2024

OK so I found where this is happening in the src code:
In services/exporter/index.js

async function getData(target, options, userAbility) {
  const { uid, attributes } = target;
  const permissionsManager =
    strapi.admin.services.permission.createPermissionsManager({
      ability: userAbility,
      model: uid,
    });

  // Filter content by permissions
  const query = permissionsManager.queryFrom({}, PERMISSIONS.read);
  console.log("QUERY: ", query); // check query data before change
  query._limit = 200; // <<<<< set the return limit here
  console.log("QUERY: ", query); // check query data after change

  const items = await strapi.entityService.find(
    { params: query },
    { model: uid },
  );

  return Array.isArray(items)
    ? items.map((item) => cleanFields(item, options, attributes))
    : [cleanFields(items, options, attributes)];
}

@EdisonPeM
In the code above I simply added the _limit param as a key to the object. The exporter then exported >100 rows :)
Any chance a fix could be made to either:

  1. Set the limit to something like 999999
  2. Have an input that allows the user to specify the _limit amount

BTW Nice work on this plugin ❤

from strapi-plugin-import-export-content.

b-emini avatar b-emini commented on May 8, 2024

@mazero Maybe you could create a merge request with your solution.

from strapi-plugin-import-export-content.

deepakrudrapaul avatar deepakrudrapaul commented on May 8, 2024

I have created a merge request with the solution mentioned above, It would be great if @EdisonPeM merge it.

from strapi-plugin-import-export-content.

R-Sudharsan25 avatar R-Sudharsan25 commented on May 8, 2024

OK so I found where this is happening in the src code: In services/exporter/index.js

async function getData(target, options, userAbility) {
  const { uid, attributes } = target;
  const permissionsManager =
    strapi.admin.services.permission.createPermissionsManager({
      ability: userAbility,
      model: uid,
    });

  // Filter content by permissions
  const query = permissionsManager.queryFrom({}, PERMISSIONS.read);
  console.log("QUERY: ", query); // check query data before change
  query._limit = 200; // <<<<< set the return limit here
  console.log("QUERY: ", query); // check query data after change

  const items = await strapi.entityService.find(
    { params: query },
    { model: uid },
  );

  return Array.isArray(items)
    ? items.map((item) => cleanFields(item, options, attributes))
    : [cleanFields(items, options, attributes)];
}

@EdisonPeM In the code above I simply added the _limit param as a key to the object. The exporter then exported >100 rows :) Any chance a fix could be made to either:

  1. Set the limit to something like 999999
  2. Have an input that allows the user to specify the _limit amount

BTW Nice work on this plugin ❤

I couldn't find the file you're specifying can you check if its added as a feature because I am stuck at this point. Also should I rebuild after making the change?

from strapi-plugin-import-export-content.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.