#How to get all keys in a collection? => create a map for it for loops

49 messages · Page 1 of 1 (latest)

velvet plover
#

Quick db (mongodb) with MongoDriver.

fervent coral
velvet plover
#

oh sry I didnt see

#

But
db.all()[0] does'nt work

fervent coral
#

You need to await the all method

velvet plover
#

Ok. And ehat is init() really doing?

#

and the useNormalKeys() or the createSingelton?
I dont find a longer description 🙃

fervent coral
#

Init only makes sure the database was prepared.
This was introduced as a bug fix.

Next release, connect (from driver) won't be needed, only init

Also like I said before. The docs are in the making. There is no description for anything yet unless it was documented in an old doc version

velvet plover
#

all fine

fervent coral
#

To add to it. Normalkeys is to disabled dot notion

#

Some people want to use emails for example as keys. But since emails includes a dot it will be interpreted as a dot notation which is sometimes not wanted

velvet plover
#

ahh yeah. But this is a change globally for every next interaction to the db?

fervent coral
#

A singleton is a way of only making one instance of a class and using the same one everytime instead of making more instances

velvet plover
#

I mean when I disable it, it cant be enabled for other sets

fervent coral
#

Normalkeys changes it globally

velvet plover
fervent coral
#

I didn't understand exactly what you meant

velvet plover
#

I can create with singelton an extra instance for disbaled dot notion for emails as I created an instance with other collection in db

fervent coral
#

No, that is not how it works

#

A singleton makes only 1 instance

#

Only one. There is no other instances

velvet plover
#

do you have a short example? When you want to write :3

fervent coral
#

UseNormalKeys will act on the instance you use it on

#

If you want one instance with normal keys and the without. You shouldn't use singletons

velvet plover
#

thx

#

Bit this works here:

let db1 = database
let db2= database
db2.UseNormalKeys(false)

It will only act to db2 or?

fervent coral
#

Both

#

Db1 and db2 has the same instance

velvet plover
#

oh and hoe I can split this?

fervent coral
#

By creating a new instance

velvet plover
#

with tableasync I was able to make 2 instances with different collections

velvet plover
fervent coral
#

The connection doesn't need to be a new instance

velvet plover
#

okay

fervent coral
#

You can have two quick.db instance sharing the same connection

velvet plover
#

I want it try out later. But I dont know exactly how to create more instances with one connection

fervent coral
#

You should make sure you get the understanding of how objects work in Javascript.

new QuickDB()
^ this, is making a new instance

velvet plover
#

oh lol

#

ok thx for the support 👍

fervent coral
#

You're welcome. Most of the instance things, singleton are more Javascript knowledge. So I will not go too in depth in them

velvet plover
#

Yeah I know about classes but I didnt know hoe to create it with one connection

#

☺️

fervent coral
#

What I sent is not how to create one with one connection

#

What I sent was just how to create a new instance which is the basic of how classes and objects works

velvet plover
#

yeah I mean this

#

Is quickdb in ts or js?