1

How can i call this mongo-shell command:

db.coll.count()

using restheart?

I tried this:

http GET 127.0.0.1:8080/cloneGame/players/_count

but got 403 Forbidden Error. Is there something wrong with my authentification?

Thank you :)

f.b.
  • 490
  • 1
  • 5
  • 17

1 Answers1

2

You get the count of the collection adding the count query parameter to the request URL.

With it RESTHeart adds the _size property to the response.

If you are only interested on getting the count of the collection (without GETting documents) you can do:

http GET 127.0.0.1:8080/cloneGame/players?count\&pagesize=0

More info in the Query Documents documentation section.

Andrea Di Cesare
  • 1,125
  • 6
  • 11
  • Andrea we need to double check this, in my case I'm getting all the documents even if I add the &pagesize=0. It doesn't make any difference. – mturatti Jan 07 '16 at 00:44
  • Maurizio, you probably need to escape the & otherwise the terminal will interpret it as the background operator, I have updated the answer accordingly – Andrea Di Cesare Jan 08 '16 at 09:14