db.group.find is not a function (shell):1

2,015 views
Skip to first unread message

Monty

unread,
Jul 13, 2012, 7:47:38 AM7/13/12
to mongod...@googlegroups.com
Trying to fetch some objects from my own collection "group" won't work.
Executing "db.group.find()" in mongodb shell relays to the following return:

Fri Jul 13 13:42:25 TypeError: db.group.find is not a function (shell):1

I think, db.group is already used by mongodb.

How should I use the group-collection?

Thanks!

Using: mongodb 2.0.6 x86_64 on archlinux

Sam Millman

unread,
Jul 13, 2012, 8:01:20 AM7/13/12
to mongod...@googlegroups.com
Group returns a single BSON object (document) with the results in. You filter out the results from the BSON document fields.

It is not a collection.

--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to
mongodb-user...@googlegroups.com
See also the IRC channel -- freenode.net#mongodb

Sam Millman

unread,
Jul 13, 2012, 8:01:54 AM7/13/12
to mongod...@googlegroups.com
OOps I completely misread that question.


try:

db.getCollection("group").find()

Monty

unread,
Jul 13, 2012, 8:11:08 AM7/13/12
to mongod...@googlegroups.com
great, this works :), but shouldn't db.group.find() work, too?


Am Freitag, 13. Juli 2012 14:01:54 UTC+2 schrieb Sammaye:
OOps I completely misread that question.


try:

db.getCollection("group").find()

On 13 July 2012 13:01, Sam Millman <[...]> wrote:
Group returns a single BSON object (document) with the results in. You filter out the results from the BSON document fields.

It is not a collection.
On 13 July 2012 12:47, Monty <[...]> wrote:
Trying to fetch some objects from my own collection "group" won't work.
Executing "db.group.find()" in mongodb shell relays to the following return:

Fri Jul 13 13:42:25 TypeError: db.group.find is not a function (shell):1

I think, db.group is already used by mongodb.

How should I use the group-collection?

Thanks!

Using: mongodb 2.0.6 x86_64 on archlinux

--
You received this message because you are subscribed to the Google
Groups "mongodb-user" group.
To post to this group, send email to mongod...@googlegroups.com
To unsubscribe from this group, send email to

Sam Millman

unread,
Jul 13, 2012, 9:29:35 AM7/13/12
to mongod...@googlegroups.com
group is a special function like help()

It is the reason why I misread your question first time around :)

So basically if its a function it will try and run that function otherwise it will try and find that collection.

I think help and group are the only ones you gotta look out for, maybe distinct (can't remember if thats a collection function or db function, it's in the docs though).

Mathias Rohnstock

unread,
Jul 13, 2012, 9:35:05 AM7/13/12
to mongod...@googlegroups.com
ok, thanks for the explanation :)

2012/7/13 Sam Millman <sam.m...@gmail.com>
Reply all
Reply to author
Forward
0 new messages