question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Count example in the docs seems wrong

See original GitHub issue

Hello! Thanks for the great lib ^_^

I’ve been testing a bit the examples, and found out that

# Getting the total of records
db.users.count()

in the README doesn’t work for me, while db.users.find().count() does.

Am I doing something wrong or is the docs to fix? Thank you, have the greatest day

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
pdonoriocommented, Apr 22, 2020

@davidlatwe you are right:

docker run --rm -it python:3.8-alpine ash

$ apk add git
# [...]
$ pip install git+https://github.com/schapman1974/tinymongo.git
# [...]
Successfully installed pymongo-3.10.1 tinydb-3.15.2 tinydb-serialization-1.0.4 tinymongo-0.2.1
$ python
Python 3.8.2 (default, Mar 24 2020, 02:56:01)
[GCC 9.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from tinymongo import TinyMongoClient
>>> collection = TinyMongoClient().mydb.users
>>> collection.count()
0

So the docs for the current stable are not to be found in the README, obviously, sorry. My fault.

Two things as side notes:

  1. should a new version be released on Pypi if the current one is too old?
  2. I’ve just find out that pymongo API moved from query_set.count() to collection. count_documents(query), as shown in: https://api.mongodb.com/python/current/tutorial.html#counting. Maybe you want to reflect this change too?

I can open other issues for those if you like, and try to help out with a PR for the second one.

I’ll close this one as we’ve found I was wrong, thanks!

0reactions
schapman1974commented, Apr 21, 2020

Yeah happy to review PR for that. I can get PyPi updated this week sometime

Read more comments on GitHub >

github_iconTop Results From Across the Web

Word count error in Google doc
Error for word count in Google word doc. The Same document when I download in my laptop and I see the word count...
Read more >
Why Does the Word Count Differ Between Programs?
For instance, Google Docs and Microsoft Office will give you two different word counts—even though the text being processed is the same!
Read more >
How does the messages-count example in Meteor docs work?
The document will have two fields: a roomId with the ID of a room, and count : the total number of messages in...
Read more >
Google Sheets COUNT and COUNTA functions with formula ...
Let's get right into it. What is COUNT and COUNTA in a Google spreadsheet? How to use Google Sheets COUNT and COUNTA –...
Read more >
Video: Work with word counts in your document
Training: Watch this video to learn how to track the word count in your document as you work. And if you need to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found