Closed andrewbenrichard closed 3 years ago
What have you tried so far? How are you trying to manipulate pieces in the database and where in the code are you trying to do it? Often that can lead to problems if something is changed that Apostrophe needs. There are ways to do it safely, though.
For now, I can't find pieces I added from the site on MongoDB. There are ways to do it safely, though.
There are ways to do it safely, though.
Please what are the recommended methods of doing this
The pieces are all in the aposDocs
collection. You can find them by their type
property. So if it's an article
piece type, you could use the { type: 'article'}
query.
I still don't know if you are trying to do this from server side code or from the MongoDB CLI, for one thing. This is a good place to start finding more information: https://v2.docs.apostrophecms.org/advanced-topics/database/accessing-the-database-directly.html. Or this, being the safer method: https://v2.docs.apostrophecms.org/advanced-topics/database/cursors.html#an-illustrated-example.
If you are using Apostrophe 3 it works similarly, but we don't have that documented in the V3 docs yet.
I want to manipulate pieces but can't find them in my MongoDB collection, how do I do that please