How to get all node ids from same content type I am using Drupal 8 and I want to create related content, but the problem is that I can't figure it out, how I can get all node IDs(except current one) for a specific content type.
This is a basic query that returns last 10 changed nodes (published) of type 'article'. Modify for your needs.


$query = \Drupal::entityQuery('node')
  -&gt;condition('status', NODE_PUBLISHED)
  -&gt;condition('type', 'article')
  -&gt;range(0, 10)
  -&gt;sort('changed', 'DESC');
$nids = $query-&gt;execute();