1.0.2 • Published 3 years ago

mongo-glow-types v1.0.2

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

mongo-glow

connecting

const uri = //your_database_uri
const DB = require("mongo-glow")
DB.connect(uri).then(async()=>{
    const db = new DB.getDB("test")
})

usage

  • set
db.set("test",{name:"a"})
  • get
db.get("test").then(data=>{
    console.log(data)
})
//{name:"a"}
  • delete
db.delete("test")
  • getByIndex
db.getByIndex("test")

you may know what an index is from here

  • getAll
db.getAll().then(data=>console.log(data))
//Map(2) { 'test' => 'a', 'help' => 'ping' }

index

index is a keyword for finding datas. for example, you've setted a data by;

db.set("test","value")

than you can get this either by

db.get("test")

or by

db.getByIndex("value")

indexes are automaticly made when the value is a type of string or a number. otherwise please make an index by

db.set("test",{name:"a",id:114514},"a")