NeDB question

353 views
Skip to first unread message

Jens Christian Rodi Hansen

unread,
Nov 18, 2013, 10:24:43 AM11/18/13
to nod...@googlegroups.com
Hi,

I'm new to Node, trying to build a small application on node-webkit, which needs a little embedded database. I found NeDB, seemed to fit my purpose.

I add a number of documents, each containing field with an identifier, which can be the same for multiple documents. It is used to group the documents. Later I would like to get at list of all posible values for this identifier, so I can lists these. I know how to do this in an SQL based database, just selecting the unique values for a field, but I cannot figure out how to get the similar done in NeDB.

Any quick pointers to help me get on?

Yours,
Jens Christian Rodi Hansen

Paul Spaulding

unread,
Nov 18, 2013, 3:21:36 PM11/18/13
to nod...@googlegroups.com

Jens Christian Rodi Hansen

unread,
Nov 18, 2013, 3:47:37 PM11/18/13
to nod...@googlegroups.com
Could you be a bit more specific on which of these 100 issues relate to my question? I do not consider this an issue/bug so creating a new would be inappropriate.


Yours,
Jens Christian Rodi Hansen

Peter Rust

unread,
Nov 19, 2013, 12:54:25 AM11/19/13
to nod...@googlegroups.com
Perhaps Paul meant to just link to the repo, meaning "go read the docs", but accidentally linked to the issues page? Oh -- now that I look into it -- perhaps it is actually a missing feature that you could open an issue about to see if the maintainer would be open to a pull request with the new functionality. The NeDB API is intended to be a subset of the MongoDB API and Mongo has a collection.distinct() command that isn't implemented for NeDB yet: http://docs.mongodb.org/manual/reference/method/db.collection.distinct/

You could just write it in client code using _.uniq() or writing your own unique function -- or you could implement it inside NeDB and send a Pull request with the feature to get it upstreamed...

-- peter

Jens Christian Rodi Hansen

unread,
Nov 19, 2013, 2:59:21 AM11/19/13
to nod...@googlegroups.com
Thanks Peter, this was the response I was looking for. I did read through the NeDB documentation but couldn't find anything resembling this functionality.

Now I know the feature isn't currently available and can evaluate my options. I'll probably go for an alternate implementation in my app.


Yours,
Jens Christian Rodi Hansen

Paul Spaulding

unread,
Nov 19, 2013, 9:55:27 AM11/19/13
to nod...@googlegroups.com
Sorry, that was rather cryptic.  I was simply suggesting that you might get a better/quicker answer if you posted the question to the NeDB group rather than on the general node mailing list.  As of today, there are over 47,000 modules on npm.  I don't think it would make sense if everyone that had a question on one of those modules posted here.  Your question has more to do with the NeDB library, and practically nothing to do with node.

I've only played with nedb a little bit, but as Peter stated, the API is supposed to be a drop-in replacement for MongoDB, but the distinct() command doesn't seem to be available.

Whether right or wrong, I've seen plenty of people post questions on a github issues list; not a big deal.  Often the question is answered and then closed, and then someone with the same question in the future can find it there and learn from it.  If someone had to ask a question, there is an "issue" that perhaps the documentation could be more complete.
Reply all
Reply to author
Forward
0 new messages