aoijs / aoi.js

aoi.js - The most advanced string-based package to create a Discord Bot fast and powerful.
https://aoi.js.org
Apache License 2.0
342 stars 134 forks source link

Possible to use mongodb as a database (using Client Option [optional ofc]) #248

Closed NotKaskus closed 3 years ago

NotKaskus commented 3 years ago

Type

Description

Variables System will use mongoDB database, like this, bot.mongoDatabase("mongoURI", "some password", other option in mongoDB);. It will be a lot more easier for managing data + less storage = smoother server

ap0sentada commented 3 years ago

it is already possible. install dbd.mongo, read docs and use const bot = new Aoijs.bot({... database: mongo}) in constructor

ap0sentada commented 3 years ago

like this:

const mongoose = require('mongoose')
const mongo = require('dbdjs.mongo').default

mongoose.connect('mongoULR here', {
  useNewUrlParser: true,
  useUnifiedTopology: true,
  useFindAndModify: false,
  keepAlive: true
})

mongo.createModel('main')
const bot = new Aoijs.Bot({
    token: token,
    prefix: ['!'],
    mobile: false,
    fetchInvites: true,
    sharding: false,
    shardAmount: 0,
    disabledFunctions: [],
   database:mongo
})
ap0sentada commented 3 years ago

@KASKUSTTV using this, $getuservar[] etc will use mongo db

NotKaskus commented 3 years ago

@KASKUSTTV using this, $getuservar[] etc will use mongo db

Nah, I tried it like in v3 of dbd.db v4 and yeah I already transferred all my files to my mongoDB server, after that I tried all $seyVar, $getVar etc... And it just return [Object object] and it's very buggy

ap0sentada commented 3 years ago

Nah, I tried it like in v3 of dbd.db v4 and yeah I already transferred all my files to my mongoDB server, after that I tried all $seyVar, $getVar etc... And it just return [Object object] and it's very buggy

is not. I use it since forever. the problem is not with the database, but with how you are transferring

ap0sentada commented 3 years ago

@KASKUSTTV using this, $getuservar[] etc will use mongo db

Nah, I tried it like in v3 of dbd.db v4 and yeah I already transferred all my files to my mongoDB server, after that I tried all $seyVar, $getVar etc... And it just return [Object object] and it's very buggy

"dbd" or "aoi"?

NotKaskus commented 3 years ago

I tried it first in dbd.js v3 before it became aoi.js and in release of v4 of aoi.js I tried it again and it has the same problem (returns [Object object]). I ask the creator of it when it was first released and he said, "I maybe broke some code I'll try to fix it". And I follow the same procedure as stated there in #tips

bubblejoey commented 3 years ago

@KASKUSTTV using this, $getuservar[] etc will use mongo db

Nah, I tried it like in v3 of dbd.db v4 and yeah I already transferred all my files to my mongoDB server, after that I tried all $seyVar, $getVar etc... And it just return [Object object] and it's very buggy

have you tried quickmongo or quick.db?

falsisdev commented 3 years ago

@ap0sentada database: "mongo" If you don't put something that is text in a string, it will be read as a value and will give an error

BEAST2802 commented 3 years ago

@ap0sentada database: "mongo" If you don't put something that is text in a string, it will be read as a value and will give an error

Lmao wrong. mongo is already defined so if u use "mongo" then it will return database value as mongo not the value of mongo which we defined before. So absolutely wrong as i know

BEAST2802 commented 3 years ago

As it will be a string and we want the const mongo value not the string value as the string value is the value inside a string like for ur opinion "mongo" is a string whose value is mongo but we don't want the value as mongo. We want the value of the const mongo. So the correct form will be database: mongo and not database: "mongo"

Leref commented 3 years ago

This is already possible.