Duque Active Member Licensed User Longtime User Wednesday at 11:16 PM #1 Hi, I hope you can give me a hand. Inserting a document into a MongoDB collection: Main.db.GetCollection(collection).Insert(documentList) I hope to get the last inserted ObjectId... How is it done?
Hi, I hope you can give me a hand. Inserting a document into a MongoDB collection: Main.db.GetCollection(collection).Insert(documentList) I hope to get the last inserted ObjectId... How is it done?
Erel B4X founder Staff member Licensed User Longtime User Yesterday at 6:08 AM #2 I haven't touched MongoDB for a very long time, check this answer: https://stackoverflow.com/a/23077318/971547 Upvote 0
I haven't touched MongoDB for a very long time, check this answer: https://stackoverflow.com/a/23077318/971547
Duque Active Member Licensed User Longtime User Yesterday at 9:37 PM #3 In short, I need to find the last sorted id and limit it to 1. Upvote 0
teddybear Well-Known Member Licensed User Today at 2:17 PM #4 Duque said: In short, I need to find the last sorted id and limit it to 1. Click to expand... Is it you want? B4X: Dim res As List = Main.db.GetCollection(collection).Find2(Null, Null, CreateMap("_id":-1),0,1) Log(res.Get(0)) Upvote 0
Duque said: In short, I need to find the last sorted id and limit it to 1. Click to expand... Is it you want? B4X: Dim res As List = Main.db.GetCollection(collection).Find2(Null, Null, CreateMap("_id":-1),0,1) Log(res.Get(0))