MongoDB seems to be complex at first sign, but in fact is not, you could perform a complete CRUD easily if you expend some time on the documentation.
For example, lets say you need to delete some documents (rows, if you are thinking on a traditional RDBMS). First you want to find all these documents to be removed.
> db.your_collection.find({ "cvectry": "MX", "layer_id": 20 }, {})
{ "_id" : ObjectId("5e8123e8892355c921e6b436"), "layer_id" : 20 }
>
After finding all these documents to be removed, then you want to perform the following delete method as follow:
> db.your_collection.remove({ "cvectry": "MX", "layer_id": 20 }, { justOne: true })
Comentarios
Publicar un comentario