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

Problem: Some users need more help with using MongoDB to do queries #2315

ttmc opened this Issue May 29, 2018 · 5 comments


None yet
3 participants

ttmc commented May 29, 2018

We've gotten some feedback about the page about Querying in BigchainDB.

Ideas for Improvements

Provide some help with connecting to the MongoDB database, for some common setups.

Provide some query examples.

Maybe note that there are many apps that can help you visualize and query the MongoDB database in a user friendly way. We don't promote any particular one. Examples: MongoDB Compass, Studio 3T, Mongo Management Studio, NoSQLBooster for MongoDB, Dr. Mongo

@ttmc ttmc added the docs label May 29, 2018

@ttmc ttmc self-assigned this May 29, 2018


This comment has been minimized.


manolodewiner commented May 29, 2018

I created a simple script some time ago with basic search in MongoDB. Here is the link to the script:

We also faced an issue querying BigchainDB when it finds more than 490 records with metadata search, so we decided to use querying in MongoDB as well, as you can implement pagination with it. Here is a code example:

collection.find({ $text: { $search: ' "01/2016" ' } } ).skip(100).limit(10)
   .toArray(function(err, docs) {
   assert.equal(err, null);
   console.log("Found the following records");

   docs.forEach((doc, i) => {
     totalKwh += parseFloat( 
   console.log(docs.length, count,totalKwh)

I can elaborate this with more explanations and examples if needed.


This comment has been minimized.

gautamdhameja commented May 29, 2018

Here are a couple of things I had in mind while proposing this,

  1. Documentation on the MongoDB collections used by BigchainDB. For example, the assets are in asset collection and metadata is in metadata collection. The users should know what they are going to query on and how does the underlying database schema look like. This is different from the transaction schema, just to clarify.
  2. We can also give pointers on how to create custom indexes on collections. This is advanced level topic but the node administrators can create custom indexes, during deployment, instead of going with the default text search index.

The overall idea is to make the MongoDB database schema and set up more transparent to the users.


This comment has been minimized.


ttmc commented May 30, 2018

See also issue #1816


This comment has been minimized.


ttmc commented Jun 8, 2018

Maybe also mention:

There are tools that let you query a MongoDB database using SQL, e.g.


This comment has been minimized.


ttmc commented Jun 11, 2018

Also link to the BigchainDB Blog post with the examples of how to query BigchainDB data using the Mongo Shell and MongoDB Compass. That post hasn't been published yet but I hope to get it published in the next week.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment