WIP
This commit is contained in:
@@ -52,7 +52,7 @@ export default class MongoCollection {
|
||||
// If there is nothing that matches the query - does insert
|
||||
// Postgres Note: `INSERT ... ON CONFLICT UPDATE` that is available since 9.5.
|
||||
upsertOne(query, update) {
|
||||
return this._mongoCollection.update(query, update, { upsert: true });
|
||||
return this._mongoCollection.update(query, update, { upsert: true })
|
||||
}
|
||||
|
||||
updateOne(query, update) {
|
||||
|
||||
@@ -281,10 +281,14 @@ const parseObjectToMongoObjectForCreate = (className, restCreate, schema) => {
|
||||
}
|
||||
|
||||
// Use the legacy mongo format for createdAt and updatedAt
|
||||
mongoCreate._created_at = mongoCreate.createdAt.iso;
|
||||
delete mongoCreate.createdAt;
|
||||
mongoCreate._updated_at = mongoCreate.updatedAt.iso;
|
||||
delete mongoCreate.updatedAt;
|
||||
if (mongoCreate.createdAt) {
|
||||
mongoCreate._created_at = new Date(mongoCreate.createdAt.iso || mongoCreate.createdAt);
|
||||
delete mongoCreate.createdAt;
|
||||
}
|
||||
if (mongoCreate.updatedAt) {
|
||||
mongoCreate._updated_at = new Date(mongoCreate.updatedAt.iso || mongoCreate.updatedAt);
|
||||
delete mongoCreate.updatedAt;
|
||||
}
|
||||
|
||||
return mongoCreate;
|
||||
}
|
||||
|
||||
@@ -166,6 +166,11 @@ export class PostgresStorageAdapter {
|
||||
createObject(className, schema, object) {
|
||||
let columnsArray = [];
|
||||
let valuesArray = [];
|
||||
console.log('creating');
|
||||
console.log(schema);
|
||||
console.log(object);
|
||||
console.log(className);
|
||||
console.log(new Error().stack);
|
||||
Object.keys(object).forEach(fieldName => {
|
||||
columnsArray.push(fieldName);
|
||||
switch (schema.fields[fieldName].type) {
|
||||
|
||||
Reference in New Issue
Block a user