const MongoClient = require('mongodb').MongoClient;
|
|
|
|
|
|
// Connection URL
|
|
const url = 'mongodb://localhost:27017';
|
|
|
|
// Database text
|
|
const dbtext = 'electro';
|
|
|
|
var a = {
|
|
"properties": [
|
|
{
|
|
"text":"Auto (Kofferraum)",
|
|
"value":"auto"
|
|
},
|
|
{
|
|
"text":"Treppe (hochtragen)",
|
|
"value":"treppe"
|
|
},
|
|
{
|
|
"text":"Pendeln mit (Bus& Bahn)",
|
|
"value":"pendeln"
|
|
},
|
|
{
|
|
"text":"Passt in die Garderobe (klein)",
|
|
"value":"klein"
|
|
},
|
|
{
|
|
"text":"Garage (groß)",
|
|
"value":"gross"
|
|
},
|
|
{
|
|
"text":"Fahrrad Größe (mittelgroß)",
|
|
"value":"mittel"
|
|
},
|
|
{
|
|
"text":"Akku entnehmbar",
|
|
"value":"akku_entnehmbar"
|
|
},
|
|
{
|
|
"text":"Ohne Akku fahren",
|
|
"value":"ohne_akku"
|
|
},
|
|
{
|
|
"text":"Lenker vorhanden",
|
|
"value":"lenker"
|
|
},
|
|
{
|
|
"text":"Sattel vorhanden",
|
|
"value":"sattel"
|
|
},
|
|
{
|
|
"text":"Gepäcktauglich",
|
|
"value":"gepaeck"
|
|
},
|
|
{
|
|
"text":"Straßenzulassung",
|
|
"value":"zulassung"
|
|
},
|
|
]
|
|
}
|
|
|
|
console.log(a)
|
|
|
|
MongoClient.connect(url, function(err, client) {
|
|
console.log("Connected successfully to server");
|
|
|
|
const db = client.db(dbtext);
|
|
// Get the documents collection
|
|
const collection = db.collection('categories');
|
|
// Insert some documents
|
|
collection.bulkWrite([
|
|
{ insertOne: {"document": a}}
|
|
]
|
|
);
|
|
});
|