#How to get all keys in a collection? => create a map for it for loops
49 messages · Page 1 of 1 (latest)
You can use the all method
Documentation for quick.db
All returns a promise. That will for sure not work
You need to await the all method
Ok. And ehat is init() really doing?
and the useNormalKeys() or the createSingelton?
I dont find a longer description 🙃
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
all fine
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
ahh yeah. But this is a change globally for every next interaction to the db?
A singleton is a way of only making one instance of a class and using the same one everytime instead of making more instances
I mean when I disable it, it cant be enabled for other sets
Normalkeys changes it globally
ahh and with it U can use it other defined like new collection as instance?
I didn't understand exactly what you meant
I can create with singelton an extra instance for disbaled dot notion for emails as I created an instance with other collection in db
No, that is not how it works
A singleton makes only 1 instance
Only one. There is no other instances
do you have a short example? When you want to write :3
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
Singleton design pattern: https://medium.com/@andreaspoyias/design-patterns-a-quick-guide-to-singleton-pattern-60732ed43956
thx
Bit this works here:
let db1 = database
let db2= database
db2.UseNormalKeys(false)
It will only act to db2 or?
oh and hoe I can split this?
By creating a new instance
with tableasync I was able to make 2 instances with different collections
new extra connection?
The connection doesn't need to be a new instance
okay
You can have two quick.db instance sharing the same connection
I want it try out later. But I dont know exactly how to create more instances with one connection
You should make sure you get the understanding of how objects work in Javascript.
new QuickDB()
^ this, is making a new instance
You're welcome. Most of the instance things, singleton are more Javascript knowledge. So I will not go too in depth in them
Yeah I know about classes but I didnt know hoe to create it with one connection
☺️