Count number of records in array:
db.data_records.count( { dataset_id: { $in: [ 2509, 2224, 2128, 2145, 2472, 2249 ] } } )
Count number of records NOT in array:
db.data_records.count( { dataset_id: { $nin: [ 2509, 2224, 2128, 2145, 2472, 2249 ] } } )
Remove records NOT in array:
db.data_records.remove( { dataset_id: { $nin: [ 2509, 2224, 2128, 2145, 2472, 2249 ] } } )
Posted by Luis Romero to Custom Exposure (2015-04-30 00:35)