NoSQLBooster 8.0 Released!

We are pleased to mark another important milestone for NoSQLBooster for MongoDB, the final version of 8.0. This major upgrade includes using mongosh instead of legacy mongo shell as an embedded shell, support for MongoDB 6.0, MongoDB operator helper, aggregation pipeline builder, a separate result tab for each mongosh command, greatly improved data view, one-click filtering/projection, import and export tools, test data generator and more.

If you want to try NoSQLBooster 8.0 out now, you can get it from the following link.

NoSQLBooster 8.0 Download Link

The product will automatically enter the 30-day trial mode after a successful installation. At the end of the 30-day trial period, the product becomes a free edition. The free version is free for personal/commercial use but with limited functions.

The following figure shows the main interface of version 8.0.

Main interface

Let's dive in and get an overview of what's coming in NoSQLBooster 8.0!

Although we are showing screenshots of NoSQLBooster for Windows, all these new features are available for Mac OS X and Linux as well.

What's new?

MongoDB Shell (mongosh)

In version 8.0, NoSQLBooster uses mongosh as the new embedded shell to replace legacy mongo shell. To be as compatible as possible with older versions, NoSQLBooster loads mongocompat mongosh-snippets by default, which provide mongo legacy shell compatibility APIs.

Click here to view compatibility Changes with Legacy mongo Shell

Breaking Changes

In addition to the compatibility changes officially listed by MongoDB, we will focus here on some unlisted breaking changes.
Special attention should be paid to the cursor.map() method, which is more commonly used and may prevent some of the existing code from working.

1. cursor.map (return value is changed from Array to Cursor object)

The cursor.map() method of mongosh return a Cursor object, whereas legacy mongo shell returns an Array directly. Note that .map() only converts the type, it does not create a new cursor. You can convert the Cursor object to an Array with .toArray().

Let's compare the code. The official example of mongodb is used here.

Create a collection products with these documents

1
2
3
4
5
6
db.products.insertMany([
{ _id: 1, name: 'widget', price: 10.89 },
{ _id: 2, name: 'thing', price: 11.24 },
{ _id: 3, name: 'moppet', price: 8 },
{ _id: 4, name: 'cosa', price: 24.19 }
])

Calculate a discounted sale price and return the results as an array.

1
2
3
4
5
6
7
//mongosh
var salePrices = db.products.find().map((p)=>p.price * 0.9).toArray();

//legacy mongo shell, no toArray()
var salePrices = db.products.find().map((p)=>p.price * 0.9);

//salePrices [9.801,10.116,7.2,21.771]

2. db.getUsers (return value is changed from Array of users to result.users)

Let's compare the return value.

1
db.getSiblingDB("products").getUsers( { showCustomData: false } )

Example output from mongosh:

1
2
3
4
5
6
7
8
9
10
11
12
13
{
users: [
{
_id: 'products.accountAdmin01',
userId: UUID("0955afc1-303c-4683-a029-8e17dd5501f4"),
user: 'accountAdmin01',
db: 'products',
roles: [ { role: 'readWrite', db: 'products' } ],
mechanisms: [ 'SCRAM-SHA-1', 'SCRAM-SHA-256' ]
}
],
ok: 1
}

Example output from legacy mongo shell:

1
2
3
4
5
6
7
8
9
10
[
{
_id: 'products.accountAdmin01',
userId: UUID("0955afc1-303c-4683-a029-8e17dd5501f4"),
user: 'accountAdmin01',
db: 'products',
roles: [ { role: 'readWrite', db: 'products' } ],
mechanisms: [ 'SCRAM-SHA-1', 'SCRAM-SHA-256' ]
}
]

In mongosh, to get a list of users, you need to execute:

1
2
3
db.getUsers().users;// mongosh

//db.getUsers(); //legacy mongo shell

3. db.getRoles (return value is changed from Array of roles to result.roles)

Like the db.getUsers method, mongosh changed the return value from Array of roles to result.roles.

In mongosh, to get a list of roles, you need to execute:

1
2
3
db.getRoles().roles;// mongosh

//db.getRoles(); //legacy mongo shell

MongoDB 6.0 support

NoSQLBooster 8.0 upgrades the MongoDB Node.js driver to 4.10 and embedded mongosh to 1.6, adding support for all the new aggregation stages and operators of MongoDB 6.0, and NoSQLBooster 8.0 allows all new MongoDB 6.0 aggregation expressions to be used as SQL functions in SQL statements.

MongoDB 6 new stages ($documents, $densify and $fill)

MongoDB 6.0 adds new stages, $documents, $densify and $fill. NoSQLBooster adds the equivalent aggregation chain method and code templates for these new stages.

  • $documents - Returns literal documents from input values.
  • $densify - Creates new documents in a sequence of documents where certain values in a field are missing.
  • $fill - Populates null and missing field values within documents.

Here is an example of using $documents and $densify

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
db.aggregate().documents([
{
"metadata": { "sensorId": 5578, "type": "temperature" },
"timestamp": ISODate("2021-05-18T00:00:00.000Z"),
"temp": 12
},
{
"metadata": { "sensorId": 5578, "type": "temperature" },
"timestamp": ISODate("2021-05-18T12:00:00.000Z"),
"temp": 12
}
]).densify({
field: "timestamp",
range: {
step: 1,
unit: "hour",
bounds: [ISODate("2021-05-18T00:00:00.000Z"), ISODate("2021-05-18T08:00:00.000Z")]
}
})

Equivalent to the following mongosh script, but more concise, and easy to write, not to mention code completion.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
db.aggregate(
[
{
"$documents" : [
{
"metadata" : {
"sensorId" : 5578,
"type" : "temperature"
},
"timestamp" : ISODate("2021-05-18T08:00:00.000+08:00"),
"temp" : 12
},
{
"metadata" : {
"sensorId" : 5578,
"type" : "temperature"
},
"timestamp" : ISODate("2021-05-18T20:00:00.000+08:00"),
"temp" : 12
}
]
},
{
"$densify" : {
"field" : "timestamp",
"range" : {
"step" : 1,
"unit" : "hour",
"bounds" : [
ISODate("2021-05-18T08:00:00.000+08:00"),
ISODate("2021-05-18T16:00:00.000+08:00")
]
}
}
}
])

MongoDB Atlas Search ($search)

NoSQLBooster also adds the equivalent aggregation chain methods (AggregationCursor.search and AggregationCursor.searchmeta) and code templates for MongoDB Atlas Search stages $search and $searchmeta.

Here is an example for Single Field Search

1
2
3
4
5
6
db.cars.aggregate().search({
text: {
query: "Ford",
path: "make"
}
})

MongoDB shell extension

MongoDB Operator Helper ($)

NoSQLBooster version 8 exposes a new global variable, $, which converts chained MongoDB operator methods into a JSON object. We call it the operator helper. It upgrades the query builder(qb) from previous versions to support all MongoDB operators, not just operators for the db.collection.find methods. You can use it directly in any mongosh method. NoSQLBooster provides a large number of code templates to simplify the input of method parameters. The form of the chained method is also easier to read and error check.

Here are a few simple rules for using operator helper

  1. Except for the $.where("field") and $.build() method, all the other methods are simple and correspond to an operator of MongoDB. e.g. $.gte(xxx) -> { $gte: xxx }
  2. If the method has only one parameter, a key-value pair is generated directly. e.g. $.gte(5) -> {$gte: 5}.
  3. If the method has more than one parameter, the parameters is converted to an array in the generated JSON object. e.g. $.gte("$f1", 5) -> {$gte: ["$f1", 5] }

Let's take a look at some examples.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
 print($.gte(18).lte(65)); // OperatorHelper ->  { $gte:18, $lte:65 }

print($.gte(18).lte(65).build()); // got plain JSON object, Can be used in non mongosh method, { $gte:18, $lte:65 }

print($.gte("$age", 18)); // OperatorHelper: -> { $gte: ["$age", 18] }

// instead of writing:
db.users.findOne({age:{$gte:18,$lte:65}});

// we can write:
db.users.findOne($.where("age").gte(18).lte(65));


// instead of writing:
db.users.updateOne({_id:1}, {$set: {lastLoginTime: new Date()}, $inc: {numberOfLogins: 1}});

// we can write:
db.users.updateOne({_id:1}, $.set({lastLoginTime: new Date()}).inc({numberOfLogins: 1}));

//instead of writing:
db.inventory.aggregate([{
$project: {
item: 1,
qty: 1,
qtyGte250Lt500: {
$and: [{
$gte: ["$qty", 250]
}, {
$lt: ["$qty", 300]
}]
},
_id: 0
}
}, {
$limit: 1000
}])

//we can write:
db.inventory.aggregate().project({
item: 1,
qty: 1,
qtyGte250Lt500: $.and($.gte("$qty",250), $.lt("$qty", 300)),
_id: 0
}).limit(1000)

//or
db.inventory.aggregate().project(
$.where("item",1)
.where("qty",1)
.where("qtyGte250Lt500").and($.gte("$qty",250), $.lt("$qty", 300))
.where("_id",0)
).limit(1000)

Aggregation Pipeline Builder ($.pipelineBuilder)

In previous versions, we have implemented chained aggregate pipeline builder, all MongoDB aggregate stage have a corresponding chainable method.

To create an aggregation pipeline, use the following syntax in the MongoDB Shell:

1
2
3
4
5
6
7
8
9
10
11
12
db.<collection>.aggregate([
{
<$stage1>
},
{
<$stage2>
}
{
<$stage3>
}
//...
])

We can write in NoSQLBooster:

1
2
3
4
db.<collection>.aggregate()
.stage1()
.stage2()
.stage3()

In version 8, we enhanced the use scenario of the chained methods, which you can use it to build the pipeline parameter required in some mongodb shell methods or use it in your code.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
//instead of writing:
let pipeline=[
{
<$stage1>
},
{
<$stage2>
}
{
<$stage3>
}
//...
]

//we can write:
pipeline= $.pipelineBuilder.stage1().stage2().stage3()

Let's take a look at an example of creating a readonly view using $.pipelineBuilder.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
 //instead of writing:
db.createView(
"firstYearsScoreDesc",
"students",
[
{ $match: { year: 1 } },
{ $sort : { score: -1} }
] //pipeline
)

//we can write:
db.createView(
"firstYearsScoreDesc",
"students",
$.pipelineBuilder.match({year:1}).sort({score: -1}) //pipeline
)

Enhanced data view

Data representation is a very important part of graphical user interface tools. In version 8, the biggest enhancement is that multiple query commands in a single script can be displayed side by side as tabs, and the results of each mongosh command can be displayed in an exclusive query result tab.

Pressing F5 or Command+Enter to execute the selected script retains the open results tabs, while executing the entire script closes all open results tabs first.

One-click filtering

One-click filtering

This feature has been greatly enhanced so that it can now generate a submenu of query conditions based on the BSON type of the value, rather than just the value equality comparison.
For date types, we have added a variety of query options for a range of dates, including day, month, week, year, etc.

The following figure shows an one-click filtering submenu of date-type data, which you can access by right-clicking a cell in the tree / table view.

One-click filtering

The following is the code generated by clicking on the "dob in year (1976)" menu item, the query condition is to filter the data of all birthdays in 1976.

1
2
3
4
5
6
7
8
db.unicorns.find()
.where("dob", {
$gte: ISODate("1976-01-01T00:00:00.000+08:00"),
$lt: ISODate("1977-01-01T00:00:00.000+08:00")
})
.projection({})
.sort({ _id: -1 })
.limit(1000)

One-click projection

The One-click projection feature adds a context sub-menu, a new option to exclude fields, and a dialog box for field selection.

The following figure shows the new one-click projection sub-menu, which you can access by right-clicking cell in the tree/table view.

One-click projection

The following figure shows the field chooser, and you can either include / exclude the selected fields, or reorder the fields by dragging and dropping them.

One-click projection Fields Chooser

Display DateTime in

The date-time display format now supports time zone offset and relative time. By default, the relative time is visible, and you can switch through the settings menu on the toolbar.

Display Datetime in ...

Display Binary Buffer Encoding in

In this version, we have added several character encodings such as utf8, ascii, ucs2, and so on, which you can set in the settings sub-menu. Tooltips for binary fields also support this encoding setting.

Display Binary Buffer Encoding in ...

Tooltip

We continue to enhance our view of different types of data, and in this release, you can preview the image URI in the tooltip, as well as the data URI of the image type (eg. data:image/png).

Tooltip for image uri

The column headings of the table view also add tooltips for displaying BSON data types

Tooltip for column headers

Tree View (new Filter Row)

The new filter row allows end-users to filter tree view data by typing text directly into the row. The filter row is scoped only to data on the current page.

To toggle the filter row at the top of the tree view, press CTRL+F. This feature is also applicable to table view.

Tree view filter Row

JSON View (new Relaxed EJSON format)

A new relaxed EJSON format has been added to the JSON view. The Relaxed mode format is more concise and closer to ordinary JSON, but does not represent all the type information such as the specific byte size of number fields.

Canonical format VS Relaxed format

JSON view relaxed EJSON

Import Data

In this version, we have added the preview function of collection import, and you can specify the bson data type of the imported field when importing the CSV file. Developers can make more complex customized imports based on the generated code, then save it as a script file, or even add automatic tasks.

The following figure shows the GUI for importing csv files. To exclude a field from the CSV file, uncheck the check box next to the field name. To select the BSON type of field, use the drop-down list below the field name.

CSV import

Export Data

In this version, we have added the preview function of collection export (up to 100 records), and you can use drag and drop to reorder the exported fields. The relaxed mode option for EJSON export is also added.

export EJSON

Test Data Generator

This version of the test data generator has been greatly improved.

  • Better guess the faker.js method of creating fake data based on the existing sample data.
  • Support positional $ operator (arrayOfNumbers.$ and arrayOfObjects.$.field)
  • Added GUI for locale selection
  • The faker.js module is updated to the 6.x version, and a large number of API methods are added to generate different types of fake data.

The following figure shows the main interface of the test Data Generator. You can access this tool from the DataGen button on the main toolbar or from the main menu Tools- > Test Data Generator

Test data generator

The following is an example of a generated creation of 1M fake people data.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
//faker.js - generate massive amounts of fake data
//usage: https://v6.fakerjs.dev/
faker.locale = "es"; // en|es|de|fr|it|ja|ko|ru|zh_CN, more https://v6.fakerjs.dev/api/localization.html


function isRandomBlank(blankWeight) {
return Math.random() * 100 <= blankWeight;
};


const COLLECTION = "testTypes";
const BATCH_COUNT = 1000;
const STEP_LEN = 1000; //total 1000 * 1000 = 1000000

for (let i = 0; i < STEP_LEN; i++) {
db.getCollection(COLLECTION).insertMany(
_.times(BATCH_COUNT, () => {
return {
"string": faker.name.findName(),
"array-number": _.range(0, _.random(1, 5)).map(() => faker.datatype.number()),
"array-object": _.range(0, _.random(1, 5)).map(() => {
return {
date: faker.date.past(),
name: faker.name.findName()
}
}),
"object": {
"city": faker.address.city(),
"zipcode": faker.address.zipCode()
},
"email": faker.internet.email()
}
})
)

console.log(db.getName() + "." + COLLECTION, `${(i + 1) * BATCH_COUNT} docs inserted`);
}

Schema Documentation

In this version, we have added the ability to export collection schema to GraphQL schema, as well as the menu items to copy Mongoose Javascript/GraphSQL Schema/JSON directly to the clipboard.

Schema Copy UI

Here is an example of the generated GraphSQL schema:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2022 NoSQLBooster All rights reserved. Generated by NoSQLBooster 8.0
type Address {
city: String,
street: String,
zip: String,
state: String
}

type people {
_id: ID!,
last_name: String,
quote: String,
job: String,
ssn: String,
address: Address,
first_name: String,
company_id: ID!,
employer: String,
birthday: String,
email: String
}

Here is an example of the generated Mongoose Javascript schema:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Copyright 2022 NoSQLBooster All rights reserved. Generated by NoSQLBooster 8.0
import mongoose from 'mongoose';
const { Schema } = mongoose;

const peopleSchema = new Schema({
last_name: String,
quote: String,
job: String,
ssn: String,
address: {
city: String,
street: String,
zip: String,
state: String
},
first_name: String,
company_id: Schema.Types.ObjectId,
employer: String,
birthday: Date,
email: String
}, { collection: "people" });

Minor Improvements

Tasks - run script task

In previous versions, the task to run the script had to specify a script file. In 8.0, we added an option to specify the content of the script directly. You can save the script in the editor as a task without having to save it as a file first.
It does not rely on local files, so it is easier to export and run on other machines.

Run script task

Tab switcher

When you switch tabs by Ctrl+Tab and Ctrl+Shift+Tab, the tabs are switched in the most recently used order instead of a sequential left-to-right/right-to-left order. At the same time, a menu that includes all open tabs pops up so that you can quickly switch tabs.

tabs switcher

Database object explorer - redesigned tree node locator

In version 8.0, we redesigned the node locator of the object explorer to improve the lookup efficiency and the usability of the interface.

  • Press Command+F to display the node locator, and press Esc to close it.

Database Object Locator

Miscellaneous improvements and bug fixes

  • Upgrade MongoDB Node.js driver to 4.10.
  • Upgrade major dependencies electron to 11.x, Node v12.8, and V8 v8.7.
  • Add optional "@mongodb-js/zstd" module to support zstd compression.
  • Redesign "New connection" dialog, add "create deployment" sub menu.
  • Unlock some of the code IntelliSense to the free version.
  • Update the type definition of mongosh and the 3rd dependent library to the latest.
  • Code Editor - formats the selected code by Alt+Shift+F, or the entire code if the selected code is empty.

Patch Releases

Version 8.0.2

  • Improved, add more zoom out/in factors. Menu-> View -> Zoom Out/In...
  • Fixed, an formatting error in the ops(number of operations that used the index) field of tooltips for collection indexes.
  • Fixed, a bug in the test data generation tool, missing a parameter in the gender field of predefined user card.
  • Fixed, a bug in the schema tool, if you have already generated collection's schema, should give priority to displaying the generated results when entering the schema tool UI.
  • Fixed, a bug in the object explorer, when refreshing a collection node, the display status of other connection nodes should not be affected.

Version 8.0.3

  • Fixed, a UI bug in the tree view where when the result row was expanded, the screen jumped back to the top of the first row.
  • Fixed, a UI bug where when the application switches to the foreground, the focus of the pop-up value editor always switches back to the code editor.

Version 8.0.3

  • Fixed, a UI bug in the tree view where when the result row was expanded, the screen jumped back to the top of the first row.
  • Fixed, a UI bug where when the application switches to the foreground, the focus of the pop-up value editor always switches back to the code editor.

Version 8.0.4

  • Improved, expose the built-in Node.JS module (fs, path ...).

Version 8.0.5

  • Improved, greatly improves the performance of fetching MongoDB schema data and speeds up the speed of general queries.
  • Improved, added "(administrator)" to the window title if you are launching NoSQLBooster as an administrator under Windows.
  • Improved, added the colored connection info in the confirmation dialog box when dropping a collection/database.
  • Fixed, an error that could not read the X.509 certificate subject correctly.

Version 8.0.6

  • Fixed, a serious bug that prevented cursor navigation When the data View has multiple tabs containing cursors.

Version 8.0.7

  • Fixed, a regression error that prevented one-click export from being executed.
  • Fixed, a percentage formatting error for the schema type distribution bar.

Version 8.0.8

  • Fixed, a "cannot use import statement outside a module" runtime error in the "use NPM Packages" sample.
  • Improved, more zoom-in factors "Menu -> View -> Zoom Out/In..." has been added.
  • Improved, more detailed validation error description has been added.

Version 8.0.9

  • Fixed, an unexpected "SyntaxError: Unexpected token '<' in JSON at position xxxxx" error when importing mongoexport json file.
  • Fixed, an "command not found" error that the full path of nbcli is incorrect under macos 13
  • Fixed, an "undefined value" exception when adding the currently opened "query file" to "Favorites" (Menu -> Favorites).
  • Fixed, a bug that when pressing CMD+Q to quit the application under macos, the unsaved file prompt did not pop up.
  • Fixed, a bug that the visual explain function does not work under AWS DocumentDB.

Version 8.0.10

  • Fixed, a bug in export to SQL where the last three digits were incorrectly truncated when exporting int64 fields.
  • Improved, SQL Equi join,allows swapping field positions at both ends of the comparison.

Version 8.0.11

  • Improved, the UI option for entering profile (~/.aws/credentials) has been added to the configuration interface of MongoDB-AWS authentication.
  • Fixed, a bug in "rename database" script template.
  • Fixed, an issue where "tasks.json" was emptied when running multiple tasks successively on the command line.

Version 8.0.12

  • Improved, MongoDB AWS auth, the UI option for SSO (AWS Single Sign-On) option has been added to the configuration interface.

Version 8.0.13

  • Fixed, a bug where pressing the "del" key in Table view did not work.
  • Fixed, a bug where importing the exported connections JSON file sometimes failed when the current connection list is empty.

Version 8.0.14

  • Fixed, copy collection - a type conversion bug where double value 1.0 was automatically converted to a int32 1 when copying data
  • Fixed, json view - a display error for arrays of string type

Version 8.0.15

  • Improved, Support for connecting to MongoDB Server 7.0.x.

Thank you!

Please visit our feedback page or click the “Feedback” button in the app. Feel free to suggest improvements to our product or service. Users can discuss your suggestion and vote for and against it. We’ll look at it too.