MongoDb
when i make a new db the prefixOrNo option is available when i do refresh it disapper and the project say it disappered but before refresh and restarting the project it was available and working in the project
is there is a limit of options in each doc in mongo db or no?
5 Replies
ping me when someone answer
@vampire_godzilla. there is no limit; this is probably an issue with your code.
1. Make sure the option is included in your schema if you're using a schema-based approach (like Mongoose).
2. Are you sure the data is being saved correctly before the refresh? You can verify this by checking the database directly using a mongodb client.
3. There could be some part of your code that's deleting the option or preventing it from being saved.
4. If you're performing some operations on refresh, they might be the cause of the option disappearing.
1- option is included
2- other fields are saved
3- no
4- no
it is saved in db but i made crtl + r it disapper and i thinked it was a glitch and i made log to it and i got undefined
while when it is saved for first time i get Boolean value like it must be
Additional support via chatgpt:
Based on your description, the issue doesn't seem to be coming from MongoDB itself but is more likely related to the state management of your application. Here are some other potential factors to consider: Asynchronous operations: If your application retrieves data from MongoDB in an asynchronous manner (which is usually the case), there could be a timing issue. For instance, the application might be attempting to access the prefixOrNo field before the data has been completely retrieved. This could explain why you're getting undefined. Caching: If you're using any kind of caching in your application, it's possible that the cache might not be getting updated when you refresh the application. Application state: The issue might also lie in how your application is handling its state. For example, the application state might not be getting updated properly when you refresh the application. Client-side or server-side rendering: If your application uses server-side rendering, it's possible that the initial state is properly populated with the prefixOrNo field (which is why you see it at first), but any subsequent client-side rendering (like when you refresh the application) fails to include this field. Given these possibilities, you might want to add additional logging to see when and how the prefixOrNo field is being accessed and updated. You can also try debugging the application step by step to see where the problem lies. For instance, you might want to verify that the data returned by MongoDB includes the prefixOrNo field after refreshing the application.
I spam on ctrl + r to see if it was a glitch or no
i will try to make an interval while logging