How query a exact item in dql?

the uid function return an array, I think get a exact item by uid is a very common use case, is there a function to achieve this?

Not sure what you mean, can you elaborate?

some function can return a item by uid, like the findOne function in mongodb .

Still not sure what you mean, I don’t use mongo. Just give me an example of response you would like to see along with the query.

sorry, some function can return a item object not a array by uid, well ,this is not an important feature, developer can encapsulate one himself .

Look, all (not just UID func) functions in Dgraph return an array response. This cannot be changed. That’s why I don’t understand the case. Maybe you are taking about something else. An example might help.

If you want to guarantee a single object in the array you can limit the query using paging parameters. And in your end-client(your application) you must select object 0 from the array.

1 Like

understand