Define singleton objects
See original GitHub issueNot everything exists in multiples. In the CMS world there exists objects that are only “singular”. Everything on this page could be defined as one object called HomePage
.
Right now, there is no data structure that represent a HomePage
object above. I need to do an ugly hack and make it a list.
Issue Analytics
- State:
- Created 8 years ago
- Reactions:1
- Comments:16 (3 by maintainers)
Top Results From Across the Web
Singleton pattern - Wikipedia
In software engineering, the singleton pattern is a software design pattern that restricts the instantiation of a class to a singular instance.
Read more >What is Singleton? - Definition from Techopedia
A singleton is a class that allows only a single instance of itself to be created and gives access to that created instance....
Read more >What Is a Singleton? - Better Programming
The singleton design pattern restricts the instantiation of a class to a single instance. This is done in order to provide coordinated ...
Read more >Singleton Objects | Tour of Scala
Defining a singleton object ... An object is a value. The definition of an object looks like a class, but uses the keyword...
Read more >Singleton Class in Java - GeeksforGeeks
In object-oriented programming, a singleton class is a class that can have only one object (an instance of the class) at a time....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I’m pretty sure I’ve mentioned this elsewhere, but just to leave a note here as well: This feature is high on the list of things we’ll be addressing once 0.4 is released and stable.
The official implementation will be a streamlined workflow around the hacks that users have already established*, with a specific UI area to make editing singletons easy. We’ll open issues relating to how that’s planned to be implemented (as well as publish the designs we do for how it will work) when it’s coming up for active development.
We feel the pain of not having it (I’ve personally needed it on a few projects) but the call has been to stabilise the new React UI and Field Type components first, which despite the delay (it was a huge amount of work) I think will be the right one in the long term. Migrating data from workaround implementations to the official solution will hopefully be quite straightforward.
* one potential major difference may be that we keep all “singleton” objects in a single MongoDB collection and offload the schema completely to Keystone Lists, rather than wrapping Mongoose Schemas under the hood. Lists have matured a lot in the last few months and I think that’ll be viable, and not having a collection for each singleton is definitely preferable. Again, this will be finalised when the feature is up for development.
It’s now been over 1 year and 9 months since @JedWatson commented about this feature. Is there any progress on this??