How can I persist the data inserted permanently? #526
Answered
by
justinmchase
justinmchase
asked this question in
Q&A
-
VersionsN/A What is your question?How can I enable persistence? I have: const server = await MongoMemoryServer.create({
instance: {
dbPath: '/var/app/.data/example',
dbName: 'example'
}
}); As long as it keeps running it works perfect but if I close the process and re-open it the data is all gone. |
Beta Was this translation helpful? Give feedback.
Answered by
justinmchase
Aug 5, 2021
Replies: 1 comment
-
I figured it out. I had to set |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
hasezoey
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I figured it out.
I had to set
storageEngine: 'wiredTiger',
on the instance configuration also. When I tried it it threw an error because I had previously set the dbPath and it had files in that folder for the other storage engine. So I just deleted.data
folder and restarted and it is now persisting.