Difference between revisions of "Addon:MongoDB"

From Gramps
Jump to: navigation, search
(Viewing a database using mongo)
m (Bamaustin moved page MongoDB to Addon:MongoDB: Standardize filename in preparation for new installer tools)
(21 intermediate revisions by 6 users not shown)
Line 1: Line 1:
 
{{Third-party plugin}}
 
{{Third-party plugin}}
{{man warn|For Experts only!|Gramps is not designed to be used by multiple users at the same time.  While using a MongoDB server remotely allows multiple users to connect to a database, doing so simultaneously WILL cause database corruption and loss of data.  If you chose to set up for multiple user access, please backup frequently, and set up a system of your own to make sure that only one person is using Gramps at one time.  Gramps or the family tree MUST be closed before allowing another user to access the database.}}
+
{{man warn|{{man menu|For Experts only! This is an Experimental Unreleased addon.}}|Gramps is not designed to be used by multiple users at the same time.  While using a MongoDB server remotely allows multiple users to connect to a database, doing so simultaneously WILL cause database corruption and loss of data.  If you chose to set up for multiple user access, please backup frequently, and set up a system of your own to make sure that only one person is using Gramps at one time.  Gramps or the family tree MUST be closed before allowing another user to access the database.}}
  
The {{man label|MongoDB}} addon provides MongoDB database support for Gramps 5.x or greater.
+
The {{man label|MongoDB}} addon provides experimental MongoDB database support for Gramps 5.x or greater.
  
 
MongoDB is an open-source document-oriented NOSQL database.  
 
MongoDB is an open-source document-oriented NOSQL database.  
  
 
== Prerequisites ==
 
== Prerequisites ==
 +
 +
{{man warn|Note these instruction assume you are using Linux or development environment.|As the '''Gramps AIO & MacOS installers''' do not come with the Prerequisites and can not be installed easily. see {{bug|10491}} }}
  
 
Install the following packages:
 
Install the following packages:
Line 14: Line 16:
  
 
Start and enable the database service.
 
Start and enable the database service.
 +
 +
=== Windows & MacOS ===
 +
As the '''Gramps AIO & MacOS installers''' do not come with the Prerequisites and can not be installed easily. see {{bug|10491}}
 +
 +
;Windows:If you really want to experiment with mongodb, (this is regarded as an extremely advanced activity), you will have to build up a development environment for Gramps under Windows and then add the mongodb prerequisites there. See [[Gramps for Windows with MSYS2]]
 +
 +
;MacOS:The Mac bundle is aimed at normal users. Tinkerers can use '''MacPorts''' and have more-or-less the same environment as on Linux. ''Note that Homebrew just downloads the Gramps bundle dmg, so it won't help in this case.''  See: [[Mac OS X:Build from source:MacPorts]]
  
 
== Creating a family tree ==
 
== Creating a family tree ==
  
In the "Family Tree" tab of the Preferences, set the "Database backend" to "MongoDB".
+
In the "{{man label|Family Tree}}" tab of the Preferences, set the "{{man label|Database backend}}" to '''MongoDB'''.
  
Enter the host and port if using anything other than the defaults.
+
Enter the {{man label|Host}} and {{man label|Port}} if using anything other than the defaults.
  
In the Family Tree Manager, click "New" and enter a family tree name.
+
In the {{man label|Family Tree Manager}}, click {{man button|New}} and enter a family tree name.
  
Click the "Load Family Tree" button.
+
Click the {{man button|Load Family Tree}} button.
  
 
Create or import some data.
 
Create or import some data.
Line 31: Line 40:
 
From the command line type:
 
From the command line type:
  
$ mongo
+
<code>$ mongo</code>
  
 
At the prompt type:
 
At the prompt type:
  
> show dbs
+
<code>> show dbs</code>
  
 
You should see your family tree listed.
 
You should see your family tree listed.
  
> use Family_Tree_1
+
<code>> use Family_Tree_1</code>
  
> show collections
+
<code>> show collections</code>
  
> db.person.find()
+
<code>> db.person.find()</code>
  
 
Now you should see some data.
 
Now you should see some data.
  
<!-- Please leave at bottom of page-->
+
== Some query examples ==
 +
 
 +
<code>> db.person.find({"gramps_id": "I0044"})</code>
 +
 
 +
<code>> db.person.find({"primary_name.surname_list.surname": "Garner"}).count()</code>
 +
 
 +
<code>> db.person.find({"primary_name.surname_list.surname": "Garner", "gender": 0}).count()</code>
 +
 
 +
<code>> db.event.find({"type.string": "Birth"})</code>
 +
 
 +
==See also==
 +
* [[Addon:PostgreSQL|PostgreSQL]]
 +
* [[DB-API Database Backend]]
 +
* https://www.mongodb.com/
 +
 
 +
==Issues==
 +
* {{bug|10491}} [Gramps AIO & MacOS installers] Add prerequistes MongoDB [Wontfix][Windows use : MSYS2/ MacOS use: MacPorts]
 +
 
 
[[Category:Plugins]]
 
[[Category:Plugins]]
 
[[Category:Developers/General]]
 
[[Category:Developers/General]]

Revision as of 23:26, 5 January 2022

Gramps-notes.png

Please use carefully on data that is backed up, and help make it better by reporting any comments or problems to the author, or issues to the bug tracker
Unless otherwise stated on this page, you can download this addon by following these instructions.
Please note that some Addons have prerequisites that need to be installed before they can be used.
This Addon/Plugin system is controlled by the Plugin Manager.

Gnome-important.png
For Experts only! This is an Experimental Unreleased addon.

Gramps is not designed to be used by multiple users at the same time. While using a MongoDB server remotely allows multiple users to connect to a database, doing so simultaneously WILL cause database corruption and loss of data. If you chose to set up for multiple user access, please backup frequently, and set up a system of your own to make sure that only one person is using Gramps at one time. Gramps or the family tree MUST be closed before allowing another user to access the database.

The MongoDB addon provides experimental MongoDB database support for Gramps 5.x or greater.

MongoDB is an open-source document-oriented NOSQL database.

Prerequisites

Gnome-important.png
Note these instruction assume you are using Linux or development environment.

As the Gramps AIO & MacOS installers do not come with the Prerequisites and can not be installed easily. see 10491

Install the following packages:

  • mongodb
  • python3-pymongo

Start and enable the database service.

Windows & MacOS

As the Gramps AIO & MacOS installers do not come with the Prerequisites and can not be installed easily. see 10491

Windows
If you really want to experiment with mongodb, (this is regarded as an extremely advanced activity), you will have to build up a development environment for Gramps under Windows and then add the mongodb prerequisites there. See Gramps for Windows with MSYS2
MacOS
The Mac bundle is aimed at normal users. Tinkerers can use MacPorts and have more-or-less the same environment as on Linux. Note that Homebrew just downloads the Gramps bundle dmg, so it won't help in this case. See: Mac OS X:Build from source:MacPorts

Creating a family tree

In the "Family Tree" tab of the Preferences, set the "Database backend" to MongoDB.

Enter the Host and Port if using anything other than the defaults.

In the Family Tree Manager, click New and enter a family tree name.

Click the Load Family Tree button.

Create or import some data.

Viewing a database using mongo

From the command line type:

$ mongo

At the prompt type:

> show dbs

You should see your family tree listed.

> use Family_Tree_1

> show collections

> db.person.find()

Now you should see some data.

Some query examples

> db.person.find({"gramps_id": "I0044"})

> db.person.find({"primary_name.surname_list.surname": "Garner"}).count()

> db.person.find({"primary_name.surname_list.surname": "Garner", "gender": 0}).count()

> db.event.find({"type.string": "Birth"})

See also

Issues

  • 10491 [Gramps AIO & MacOS installers] Add prerequistes MongoDB [Wontfix][Windows use : MSYS2/ MacOS use: MacPorts]