Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

getCollection does not return nil on non existing collection #23

Open
xavierpantet opened this issue Mar 25, 2019 · 0 comments
Open

getCollection does not return nil on non existing collection #23

xavierpantet opened this issue Mar 25, 2019 · 0 comments

Comments

@xavierpantet
Copy link

Hi,
I am not sure whether this is an intended behaviour or not but I think the way getCollection() on MongoDatabase works is a bit strange.

The method's signature is the following:

func getCollection(name collectionName: String) -> MongoCollection?

Therefore, I expect to get a valid collection when collectionName corresponds to an existing collection in my database and nil when collectionName does not exist.

Instead of this, I indeed get the correct collection when collectionName is valid but when it's not I'm getting new empty collection that apparently does not even belong to my database.

Am I missing something from the doc or is there really a problem here?
Thank you in advance 😄

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant