1

I'm trying to install mongodb on Raspbian or Ubuntu Mate, but i have troubles finding de package on the repository to install it. The only one that is available is 2.4, but i'm having problems with this version because i need to import some data to a database to do some testing, but i'm getting this error:

"exception: BSON representation of supplied JSON array is too large: code FailedToParse: Date expecting integer milliseconds: offset:909"

I'm using this structure for the data that i'm importing:

{"_id":{"$oid":"5daa12bc95f4f6288c93727b"},"names":["frecuency","VLine1","VLine2","VLine3","ILine1","ILine2","ILine3","ITotal","PTotal","QTotal","STotal","TotalPower","actImpEnergy","actExpEnergy","indEnergy","capEnergy","apEnergy"],"values":[{"$numberDouble":"59.9462890625"},{"$numberDouble":"128.0234375"},{"$numberDouble":"127.263671875"},{"$numberDouble":"128.37890625"},{"$numberDouble":"272.2890625"},{"$numberInt":"280"},{"$numberDouble":"261.0390625"},{"$numberDouble":"813.328125"},{"$numberInt":"68934"},{"$numberInt":"-76578"},{"$numberInt":"104006"},{"$numberDouble":"-0.709518432617"},{"$numberInt":"114735486"},{"$numberInt":"14946131"},{"$numberInt":"1181895"},{"$numberInt":"128541205"},{"$numberInt":"192981465"}],"units":["Hz","V","V","V","A","A","A","A","W","VAr","VA","cos(phi)","Wh","Wh","VArh-ind","VArh-cap","VAh"],"codDispo":{"$numberInt":"1"},"time":{"$date":{"$numberLong":"1571409000305"}}}

And this is how i'm importing the data:

mongoimport --db dbName --collection collectionName --file fileName.json --jsonArray

I've searched the error and it seems to be fixed when you upgrade mongodb version at least to 2.6.

But the issue is that i need at least 3.4 version because i'm using it on windows and i need to use it on Raspberry for the company needs.

Hope you know something. Thank you.

5
  • What is the Raspbian version? – M. Rostami Jan 10 '20 at 16:51
  • @M.Rostami Raspbian GNU/Linux 10 (buster) – David Ramírez Jan 10 '20 at 22:50
  • It's a 32bit OS, so, the MongoDB has been updated for 64bit OSs. Therefore, you can't use it on Raspbian. Maybe you could run a 64bit OS like Fedora or Arch to achieve this goal. Check this link out. – M. Rostami Jan 11 '20 at 1:38
  • @M.Rostami So, the only way i can use Mongodb latest version is running it on 64bit OS? Which one do you recommend? I'm using Raspberry Pi 3 Model B. Meanwhile i'm going to try using Fedora. – David Ramírez Jan 13 '20 at 21:43
  • You can install Debian (not Raspbian), Arch Linux, Ubuntu ARM64, Fedora, openSUSE, etc. Also, I just updated the answer. – M. Rostami Jan 13 '20 at 22:34
1

You can directly install mongodb_3.4.18-2+b1 (ARM64) on Raspbian over debian.org, so, follow the procedure:

1. Download the package:

wget http://ftp.us.debian.org/debian/pool/main/m/mongodb/mongodb_3.4.18-2+b1_arm64.deb  

2. Install the package:

sudo dpkg -i mongodb_3.4.18-2+b1_arm64.deb   

Finished.


In addition, you may face a problem because of the architecture of this package which is ARMv8. So, try this procedure - Enabling ARMv8 on Raspberry Pi 3 B.


UPDATE:
As the comments on the question, you need a 64bit os to install newer MongoDB on the Raspberry Pi, because they've stopped updating the package on a 32bit operating system like Raspbian.

As you said that you're free to install a new OS on your Raspberry Pi, you can install Fedora, Arch Linux, Ubuntu Server, etc.

Also, there is another method that you can make the Raspbian 32bit(armhf) to 64bit(arm64). The keyword is "Multiarch". It lets you install library packages from multiple architectures on the same machine. I didn't implement Multiarch yet, however, check these links out:
Multiarch - HOWTO
Multiarch - Implementation

6
  • Thanks! I'm going to try it. – David Ramírez Jan 10 '20 at 22:50
  • enabling ARMv8 kernel won't enable 64 bit in userland - Raspbian does not include any 64bit libraries, so this won't work – Jaromanda X Jan 11 '20 at 1:18
  • @M. Rostami If i try the Raspbian Multiarch method can i install mongodb as i should do with Debian? Or should i try with Fedora directly instead? – David Ramírez Jan 14 '20 at 16:31
  • @DavidRamírez It is said that you can. I mean, as the description of Multiarch, you are able to install it. However, I didn't test. – M. Rostami Jan 14 '20 at 17:21
  • @M.Rostami To confirm the info: Can i try Multiarch on Raspbian or i should try it on Debian instead? – David Ramírez Jan 14 '20 at 19:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.