Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- my collection recored for mongodb
- {
- "_id" : ObjectId("5ba60b805f13dc37a5377302"),
- "clientID" : "5ba49a5b58db5fb63b282565",
- "propertyID" : "77f3d86a9842afa8ee7a64f3bf958ef4",
- "emod" : [
- {
- "audience" : "Mobile",
- "emodID" : "5ba5e0f47b07641eeebfad37",
- },
- {
- "audience" : "Laptop",
- "emodID" : "5ba5e0f47b07641eeebfad37",
- },
- {
- "audience" : "Games",
- "emodID" : "5ba5e0f47b07641eeebfad37"
- }]
- }
- --------------------------------------------------
- find record query
- var audienceList = ["Mobile","Laptop"];
- predictionCollection.findOne({
- "clientID": '5ba49a5b58db5fb63b282565',
- }, {
- emod: {
- $elemMatch: {
- 'audience': {"$in":audienceList}
- }
- },
- }).exec(function (err, predictionData) {
- //get output for predictionData
- emod: [ { audience: 'Mobile', emodID: [Array] } ] }
- // but i required output for
- emod: [ { audience: 'Mobile', emodID: [Array] },
- { audience: 'Laptop', emodID: [Array] }
- ] }
- });
Add Comment
Please, Sign In to add comment