# Stardog query returns NULL

**URL:** <https://community.stardog.com/t/stardog-query-returns-null/772>\
**Category:** Support\
**Created:** [January 18, 2018, 12:55pm UTC](https://community.stardog.com/t/stardog-query-returns-null/772 "2018-01-18T12:55:00Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![ishan.dindorkar](https://avatars.discourse-cdn.com/v4/letter/i/e47c2d/32.png) [@ishan.dindorkar](https://community.stardog.com/u/ishan.dindorkar)\
**Post date:** [January 18, 2018, 12:55pm UTC](https://community.stardog.com/t/stardog-query-returns-null/772/1 "2018-01-18T12:55:00Z")

</div>

Hi Team -

I am trying to play around with Stardog and came across following example code on one of the documentation pages -

```auto
const { Connection, query } = require('stardog');
 
const conn = new Connection({
  username: 'admin',
  password: 'admin',
  endpoint: 'http://localhost:5820',
});
 
query.execute(conn, 'myDatabaseName', 'select distinct ?s where { ?s ?p ?o }', {
  limit: 10,
  offset: 0,
}).then(({ body }) => {
  console.log(body.results.bindings);
});

```

I installed Stardog before running this code as Node application but I am getting back body as NULL.

Technical Specs -

OS - Ubuntu 16.04  
Stardog Version - 5.0.5.1  
Node version - 6.12.0  
NPM Version - 3.10.10

P.S - Instead of ‘myDatabaseName’, I am inserting name of my own database

Please let me know if you need additional details. I would really appreciate if you could please help me in resolving this issue.

Thanks in advance.

Best-  
Ishan

---

<div class="post-metadata">

**Author:** ![stephen](https://yyz2.discourse-cdn.com/flex030/user_avatar/community.stardog.com/stephen/32/27_2.png) [@stephen](https://community.stardog.com/u/stephen)\
**Post date:** [January 18, 2018, 2:40pm UTC](https://community.stardog.com/t/stardog-query-returns-null/772/2 "2018-01-18T14:40:17Z")

</div>

Hi Ishan,

`query.execute` has an `accept` parameter in between the `query` and `params` arguments, with which you can specify the RDF type you want your results to be. This is causing your limit and offset to be ignored and therefore every ?s in your database is being returned. Since you probably don’t care which format you get right now, try this:

```auto
query.execute(conn, 'myDatabaseName', 'select distinct...', undefined, {
  limit:10,
  offset: 0,
})

```

---

<div class="post-metadata">

**Author:** ![ishan.dindorkar](https://avatars.discourse-cdn.com/v4/letter/i/e47c2d/32.png) [@ishan.dindorkar](https://community.stardog.com/u/ishan.dindorkar)\
**Post date:** [January 19, 2018, 5:51am UTC](https://community.stardog.com/t/stardog-query-returns-null/772/3 "2018-01-19T05:51:23Z")

</div>

Hi Stephen-

Thank you very much for your prompt response. I appreciate it. I made changes as suggested by you and it worked!  
Have a great weekend!

Best-  
Ishan

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex030/uploads/stardog/original/2X/e/ed66b48a616f505106a4acde3c9cee7e6da9bc67.svg) [@system](https://community.stardog.com/u/system)\
**Post date:** [February 2, 2018, 5:52am UTC](https://community.stardog.com/t/stardog-query-returns-null/772/4 "2018-02-02T05:52:55Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
