Creates a new statement matching the keyword arguments specified. Returns the created statement.
(self, **kwargs)
| 174 | yield self.mongo_to_object(match) |
| 175 | |
| 176 | def create(self, **kwargs): |
| 177 | """ |
| 178 | Creates a new statement matching the keyword arguments specified. |
| 179 | Returns the created statement. |
| 180 | """ |
| 181 | Statement = self.get_model('statement') |
| 182 | |
| 183 | if 'tags' in kwargs: |
| 184 | kwargs['tags'] = list(set(kwargs['tags'])) |
| 185 | |
| 186 | inserted = self.statements.insert_one(kwargs) |
| 187 | |
| 188 | kwargs['id'] = inserted.inserted_id |
| 189 | |
| 190 | return Statement(**kwargs) |
| 191 | |
| 192 | def create_many(self, statements): |
| 193 | """ |