Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {"foo" : "abc-123", more fields.... }
- {"foo" : "abc-456", more fields.... }
- {"foo" : "cde-000", more fields.... }
- {"foo" : "cde-555", more fields.... }
- {"foo" : "else-9991234", more fields.... }
- {
- "abc": 2,
- "cde": 2,
- "else": 1
- }
- myColl.aggregate([
- $project: { firstPart: { ???? '$foo'
- db.collection.find().forEach(function(el){
- // here split your el['foo'] and update the el with new `foo1` which will have your first part
- })
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement