Sanjib Karmakar Posted January 17, 2019 Share Posted January 17, 2019 I have created one Mongo DB data 'ntfctndb' and collection 'ntfctncollection'. I have added following message { "_id" : ObjectId("5c2e76d4df0f51c9bbe2a573"), "messageSource" : "e722d4ae-9d27-42e0-9c39-ada9aaa17112", "messageId" : "520d125ddb3ea3003be104c2ca9619e6", "messageType" : "AFFD4825-D7C5-48F6-A892-11D9D9EFC932", "messageStatus" : "new", "hideDismiss" : "1", "messageUserId" : "181", "messagePayload" : "{"title":"System issue"}", "messageDateTime" : "2019-01-03T20:07:49.000Z" } I have used one 'Query Documents' activity and sends following queuey JSON format { "_id":"ObjectId("5c2e76d4df0f51c9bbe2a573")" } 'Query Documents' is returing following output Am I missing anything Link to comment Share on other sites More sharing options...
Sanjib Karmakar Posted January 23, 2019 Author Share Posted January 23, 2019 This is what I have found which solve the issue RAW JSON Message is { "messageSource" : "e722d4ae-9d27-42e0-9c39-ada9aaa17112", "messageId" : "520d125ddb3ea3003be104c2ca9619e6", "messageType" : "AFFD4825-D7C5-48F6-A892-11D9D9EFC932", "messageStatus" : "new", "hideDismiss" : "1", "messageUserId" : "181", "messagePayload" : "{"title":"System issue","}", "messageDateTime" : "2019-01-03T20:07:49.000Z" } When we insert it in MongoDB, using BW 'Insert Document' Activity,MongoDB adds unique identificaiton like ObjectId("5c2e76d4df0f51c9bbe2a573") { "_id" : ObjectId("5c2e76d4df0f51c9bbe2a573"), "messageSource" : "e722d4ae-9d27-42e0-9c39-ada9aaa17112", "messageId" : "520d125ddb3ea3003be104c2ca9619e6", "messageType" : "AFFD4825-D7C5-48F6-A892-11D9D9EFC932", "messageStatus" : "new", "hideDismiss" : "1", "messageUserId" : "181", "messagePayload" : "{"title":"System issue","}", "messageDateTime" : "2019-01-03T20:07:49.000Z" } Now if we use BW 'Query Documents' Activity without any query it will retrieve the data and there we can find that ObjectId is appearing as $oid { "_id" : { "$oid" : "5c2e76d4df0f51c9bbe2a573"} , "messageSource" : "e722d4ae-9d27-42e0-9c39-ada9aaa17112" , "messageId" : "520d125ddb3ea3003be104c2ca9619e6" , "messageType" : "AFFD4825-D7C5-48F6-A892-11D9D9EFC932" , "messageStatus" : "new" , "hideDismiss" : "1" , "messageUserId" : "181" , "messagePayload" : "{"title":"System issue","}", "messageDateTime" : "2019-01-03T20:07:49.000Z"} Now to retireve any Document from the MongoDB we need to use following JSON formatted Query { "_id" :{"$oid" : "5c2e76d4df0f51c9bbe2a573"}} and need to pass to BW 'Query Documents' Activity. In my case it worked. Hope it will work for you. You need to modify it according to your need. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now