0.0.22 • Published 3 years ago

raspberrypi-db v0.0.22

Weekly downloads
-
License
ISC
Repository
github
Last release
3 years ago

raspberrypi-db

How to use

  • You need to start raspberrypi-db-server click here to know how to start raspberrypi-db-server.
  • you need to install raspberrypi-db by using npm i raspberrypi-db and use it into your project.

Example

const {PiClient} = require("raspberrypi-db")

// Connection URL 
const url = 'http://{AUTH_KEY}@localhost:27017';
// example: http://shiviraj@localhost:27017

const client = new PiClient(url);

// Database Name
const dbName = 'myProject';

async function main() {
    // Use connect method to connect to the server
    client.connect();
    console.log('Connected successfully to server');
    const db = client.db(dbName);

    // create or get collection
    const collection = db.collection('documents');

    // insert many in collection
    await collection.insertMany([{"name": "shiviraj"}])

    // find all from the collection
    const data = await collection.findAll()
    console.log(data)
    return 'done.';
}

main()
    .then(console.log)
    .catch(console.error)
0.0.20

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.19

3 years ago

0.0.18

3 years ago

0.0.17

3 years ago

0.0.16

3 years ago

0.0.15

3 years ago

0.0.14

3 years ago

0.0.13

3 years ago

0.0.12

3 years ago

0.0.11

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago

1.0.0

3 years ago