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.

Milliways
  • 59,890
  • 31
  • 101
  • 209

1 Answers1

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

M. Rostami
  • 4,323
  • 1
  • 17
  • 36
  • 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 01: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
  • @DavidRamírez Yes, you can. Feel free to try it on a system you don't care about and report what happens. – M. Rostami Jan 14 '20 at 20:14